Results 1 to 2 of 2
I'm trying to combine several statements and am having trouble. I've been away from the Linux world for a while, so I'm a little rusty. Here's the deal:
I have ...
- 09-20-2007 #1Just Joined!
- Join Date
- Sep 2007
- Posts
- 1
Help with pipes
I'm trying to combine several statements and am having trouble. I've been away from the Linux world for a while, so I'm a little rusty. Here's the deal:
I have a script that is called like:Normally, that script is called and the output sent to a temporary file or to the printer like:Code:scriptname inputfile1 inputfile2
orCode:scriptname inputfile1 inputfile2 > tempfile
What I want to do is prepend some text to the output of the script so that what gets sent to the file/printer will look like:Code:scriptname inputfile1 inputfile2 | lp -d queuename
The catch is that I want to do this a) with a single command line statement and b) without any temporary files or extra scripts. Is this possible?Code:mytextscriptoutput
Thanks!
- 09-21-2007 #2
Yea, I have to do this when users need a large amount of documents printed with the filename at the top. I do something like this
So you want to do i think would be a little different, like:Code:for filename in *; do (echo $filename ; cat $filename) | lpr -P printer done
Code:(echo SOMETHING ; scriptname inputfile1 inputfile2) | lpr -P printer


Reply With Quote