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 IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Can I do this with Awk?

Status
Not open for further replies.

beaster

Technical User
Aug 20, 2001
225
US
I posted this in Unix forum, but didnt get the answer I was looking for....

I want to add lines of text at the top of several files. The text to add:

@LABEL BEGIN
@SET LOGFILE=("/home/bham_mta/rehome_scripts/cmd_file1")
@LOG(LOGFILE)
@SET SWITCH="BH1BSC1"
@CONNECT (SWITCH)

To be added to the top of each file found named rxmop_input*

I tried:

sed '1i@LABEL BEGIN
@SET LOGFILE=("/home/bham_mta/rehome_scripts/cmd_file1")
@LOG(LOGFILE)
@SET SWITCH="BH1BSC1"
@CONNECT (SWITCH)
'
rxmop_input*

But obviously that didnt work. I cant even remember where I got that from. Please guide me....

Beaster
 
insert an empty newline befor the closing ' ------------ jamisar
Einfachheit ist das Resultat der Reife. (Friedrich Schiller)
Simplicity is the fruit of maturity.
 
Yes, you can - but NOT 'in-place' editing. You'll have to wrap awk with shell and move files around.

I've posted the 'ex' in-place editing solution for this in UNIX forum. vlad
+---------------------------+
|#include<disclaimer.h> |
+---------------------------+
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top