Solved

LInux Command

Posted on 2011-03-04
6
332 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

This is the error message I got (CODE) Error caused by incompatible libmp3lame 3.98-2 with ffmpeg I've googled this error message and found out sometimes it attaches this note "can be treated with downgrade libmp3lame to version 3.97 or 3.98" …
It’s 2016. Password authentication should be dead — or at least close to dying. But, unfortunately, it has not traversed Quagga stage yet. Using password authentication is like laundering hotel guest linens with a washboard — it’s Passé.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

749 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