Solved

LInux Command

Posted on 2011-03-04
6
333 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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
NEW Veeam Agent for Microsoft Windows

Backup and recover physical and cloud-based servers and workstations, as well as endpoint devices that belong to remote users. Avoid downtime and data loss quickly and easily for Windows-based physical or public cloud-based workloads!

 
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

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

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" …
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Connecting to an Amazon Linux EC2 Instance from Windows Using PuTTY.

728 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