constructing a file for printing


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers constructing a file for printing
# 1  
Old 02-17-2011
constructing a file for printing

I have a text file, data.txt, which looks like :-

head1 head2 head3
data1 1 data 1 2 data 1 3
data 2 1 data 2 2 data 2 3
data 3 1 data 3 2 data 3 3
etc etc

I would like to print this file, using the lp -d command,
with a heading line, as follows :-

Report for whatever department as at {today's date}
Then a space line
Then all of data.txt.

I can store in a text file the first part of the heading line, up to the date.
I can then use
Code:
date > temp1
cut -d “ “ -f 1-4 < temp1 > temp2 

to get today's date,
but how do I then construct the required file for printing ?

Many thanks
# 2  
Old 02-17-2011
Code:
pr -h "Report for department at $mydate" file | lp

also look at enscript, a2ps

Andrew

Last edited by apmcd47; 02-18-2011 at 04:57 AM.. Reason: fixing typo - should have piped into lp not pr
# 3  
Old 02-17-2011
lp1 is the printer name
Code:
date > tmpfile
echo "" >> tmpfile
cat data.txt >> tmpfile
lp -d lp1 tmpfile

 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Constructing a Matrix

Hi, I do have couple of files in a folder. The names of each of the files have a pattern. ahet_005678.txt ahet_005898.txt ahet_007678.txt ahet_004778.txt ... ... ahet_002378.txt Each of the above files have the same pattern of data with 4 columns and have an header for the last 3... (4 Replies)
Discussion started by: Kanja
4 Replies

2. UNIX for Dummies Questions & Answers

Locate the column names with their values in the file and the printing the same in the other file

I have text file in Linux with two rows : first row conmtain the column nam and the second row contain its value .I nned to fetch few columns first and then redirect the data of those colum in the another file. Any ideas?? (1 Reply)
Discussion started by: Anamica
1 Replies

3. UNIX for Dummies Questions & Answers

Sco Unix printing : jobs hangs in queue - printing via lp versus hpnpf

Hi, We have a Unix 3.2v5.0.5. I installed a printer via scoadmin, HP network printer manager with network peripheral name (hostname and ipadres are in /etc/hosts). This is the configuration file : Code: root@sco1 # cat configurationBanner: on:AlwaysContent types: simpleDevice:... (0 Replies)
Discussion started by: haezeban
0 Replies

4. Windows & DOS: Issues & Discussions

Linux to Windows Printing: PDF starts printing from middle of page.

We are using Red Hat. We have a issue like this: We want to print from Linux, to a printer attached to a Windows machine. What we want to print is a PDF. It prints, but the printing starts from the middle of the page. In the report, there is no space at the top but still printing starts from the... (5 Replies)
Discussion started by: rohan69
5 Replies

5. Shell Programming and Scripting

Constructing numbers from input lines

I have a file with the information shown and I want to capture the entry having the rgdt tag and taking the value (the location of the represents the decimal point, for example 0p50 represents 0.50) I then want to divide the number at the end of each line by the value 0.50 I want to do... (7 Replies)
Discussion started by: kristinu
7 Replies

6. Shell Programming and Scripting

Constructing a string by reading the contents of 2 files

Hi all - I am trying to write a script to generate a string that gets sent to an IP phone using wget. This is to upload a phone book of up to 100 entries so the string needs to be constructed in one 'hit'. I am a relative newbie to shell scripts but willing to try anything! I have 2 files: ... (3 Replies)
Discussion started by: cakerack
3 Replies

7. Shell Programming and Scripting

Help With Constructing A Korn Shell Search Loop

Hello All, I am a statistician and I am very new to the world of ksh programming. Daily, I analyze millions of rows of data and land information to DB2 tables. I have recently been asked to develop a ksh script to FTP an export file containing line item data from the production environment to the... (2 Replies)
Discussion started by: jonesdk5
2 Replies

8. Shell Programming and Scripting

Suggestions on constructing a log file

Hi, I have a series of BASH shell scripts that run together. I would like it so that these scripts construct a log file as they run. This log file would ideally be a text file that contains exactly (including blank lines) what is output to the terminal. What is the best way to accomplish... (3 Replies)
Discussion started by: msb65
3 Replies

9. Programming

Constructing a server daemon / questions on handling clients

Hi All, I'm interested in the best way to serve multiple clients from a server process. Now, our server is going to serve data on a custom protocol and it is going to get / process that data from a number of possible back-ends including files (text or xml) and MySQL/some other database.... (2 Replies)
Discussion started by: dragonfly
2 Replies
Login or Register to Ask a Question