Solved

LInux Command

Posted on 2011-03-04
6
331 Views
Last Modified: 2013-12-16
You want to print out a text file called vacations however the lines are of varying length. What text filter could you use to even out the length of the lines?
0
Comment
Question by:Reddy4U-Solaris
6 Comments
 
LVL 31

Expert Comment

by:farzanj
ID: 35040365
Please show sample line.
How do you want to even them out?  Chop off what?
0
 
LVL 4

Expert Comment

by:Tachion
ID: 35040376
Use enscript,

See "man enscript". It works with most postscript aware printers.
If your printer is not postscript, use enscript to create a postscripts file, use ps2pdf to create a pdf and then print the pdf.


ENSCRIPT(1)                        ENSCRIPT                        ENSCRIPT(1)

NAME
       enscript - convert text files to PostScript, HTML, RTF, ANSI, and overstrikes

SYNOPSIS
       enscript  [-123456789BcgGhjkKlmOqrRvVzZ]  [-#  copies] [-a pages] [-A align] [-b header] [-C[start_line]] [-d
       printer] [-D key[:value]] [-e[char]] [-E[lang]] [-f font] [-F header_font] [-H[num]] [-i indent] [-I  filter]
       [-J title] [-L lines_per_page] [-M media] [-n copies] [-N newline] [-o outputfile] [-o -] [-p outputfile] [-p
       -] [-P printer] [-s baselineskip] [-S key[:value]] [-t title] [-T tabsize] [-u[text]] [-U num] [-W  language]
       [-X encoding] [filename ...]

DESCRIPTION
       Enscript  converts  text  files to PostScript or to other output languages.  Enscript can spool the generated
       output directly to a specified printer or leave it to a file.  If no input files  are  given,  enscript  pro-
       cesses  the  standard input stdin.  Enscript can be extended to handle different output media and it has many
       options which can be used to customize the printouts.
0
 
LVL 48

Expert Comment

by:Tintin
ID: 35040397
As this is most likely an assignment question, we aren't permitted to give you a full solution, but we can point you in the right direction.

Look into

awk
sed
cut
perl
0
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
LVL 31

Expert Comment

by:farzanj
ID: 35040405
If you have written a program and which needs to be printed with correct indentation, use expand
0
 
LVL 1

Expert Comment

by:notjames
ID: 35041736
Perl and printf() could be your friend. For that matter, awk and printf() could be your friend. Cut could be a really quick fix. Unfortunately, shell's printf is lame. :)

I'd use Perl but that's just me. Tis simple if you put some thought into it. Specificity could be required if you need more assistance. G'luck.
0
 
LVL 2

Accepted Solution

by:
maxalarie earned 500 total points
ID: 35084712
heh.. I would just cat $filename | lpr
0

Featured Post

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Error Message during CentOS 7 Minimal Install 3 58
bash file 10 49
Why  my code (program) build with old compiler? 11 77
list of sudo access for date range 5 29
Daily system administration tasks often require administrators to connect remote systems. But allowing these remote systems to accept passwords makes these systems vulnerable to the risk of brute-force password guessing attacks. Furthermore there ar…
Network Interface Card (NIC) bonding, also known as link aggregation, NIC teaming and trunking, is an important concept to understand and implement in any environment where high availability is of concern. Using this feature, a server administrator …
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

831 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question