Solved

LInux Command

Posted on 2011-03-04
6
328 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
Find Ransomware Secrets With All-Source Analysis

Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

 
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

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

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 …
Linux users are sometimes dumbfounded by the severe lack of documentation on a topic. Sometimes, the documentation is copious, but other times, you end up with some obscure "it varies depending on your distribution" over and over when searching for …
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

743 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now