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!

modify the first line using awk

Status
Not open for further replies.

eddie404

MIS
Dec 16, 2007
1
IL
hi
i have a text file and i want to add 1; to the first line
example before:
eddie.txt
hi my name is
eddie

eddie.txt
example after:
1;my name is
eddie

how can i use awk to add 1; just to the first line
do i need to create new file or i can use the same file
thanks a lot for your help.
 
Code:
awk 'NR==1{printf "1;"}1' eddie.txt > neweddie.txt

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top