Command line printing merging files
by aikempshall from LinuxQuestions.org on (#57MG1)
Apologies if this is not the right forum to post this question.
I have some documents, in plain text format, that I want to print from the command line using lp, if necessary I could use lpr.
Before printing I have to remove carriage returns.
The command I'm using is
Code:sed ':a;N;$! ba;s/\n//g' $1 | lp -d HP_LaserJet_2300_series -o cpi=14 -o page-left=48 -o page-top=96 FILE_TO_PRINTI also want to print a bespoke header at the top of each page. The header will be several lines and will probably just contain the name of my company. The same lines will appear in each print job. Effectively a bit like printing on pre-printed stationery.


I have some documents, in plain text format, that I want to print from the command line using lp, if necessary I could use lpr.
Before printing I have to remove carriage returns.
The command I'm using is
Code:sed ':a;N;$! ba;s/\n//g' $1 | lp -d HP_LaserJet_2300_series -o cpi=14 -o page-left=48 -o page-top=96 FILE_TO_PRINTI also want to print a bespoke header at the top of each page. The header will be several lines and will probably just contain the name of my company. The same lines will appear in each print job. Effectively a bit like printing on pre-printed stationery.
- Can lpr do this in one pass.
- Should I do it in two passes.
- Should I incorporate it into the sed.
- Should I add another step to append the header to the file just before printing.
- Or maybe something else.