Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Echo and cat together 4

Status
Not open for further replies.

dickiebird

Programmer
Feb 14, 2002
758
GB
Mental blockage again !
I have a file I'd like to give a heading before I print it..
So I do .........

echo ="/t/tPRODUCTION TARGETS/n/n" > tmpfile
cat tmpfile infile|lp -dprintsp1

Can anyone show me a one line solution ??
TIA

Dickie Bird (:)-)))
 
I think this may be what you need:
Code:
echo ="/t/tPRODUCTION TARGETS/n/n" | cat - infile |lp -dprintsp1
Hope this helps :)

 
Thanks Neil
Actually used :
echo PRODUCTION TARGETS;echo;echo | cat - fred

(It was the 'cat - ' that I'd forgotten)
BTW - echo ="/t/tPRODUCTION TARGETS/n/n"
gave me =/t/tPRODUCTION TARGETS/n/n Dickie Bird (:)-)))
 
BTW

cat - fred

only captures the last command and whatever is in fred
so subshell

( echo PRODUCTION TARGETS; echo ""; echo "" ) | cat - fred

to get the whole thing (all the commands plus fred).

Cheers,
ND [smile]

bigoldbulldog@hotmail.com
 
Hi

( echo PRODUCTION TARGETS ; echo "" ; echo "" ; cat fred )

would work also. The () is used if you want to redirect the output, e.g. ( echo 1 ; echo 2 ) > output

Pieter
 
mybe is /t a tab
on solaris i use printf instead of echo

(printf "\t\tyour title\n\n";cat yourfile) | lp ....
OR (this only with sed -f)
put in scmd:
------------------begin
1i your title
--------------------end
MB: the empty line at end is NEEDED.
before 'your title' you can put spaces or tabs
then: sed -f scmd yourfile | lp ... -----------
Ohne Intelligenz bist Du ein Fiasko,
ohne Technik ein Amateur und
ohne Herz eine Maschine.

[ Wladimir Horowitz ]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top