Computing.Net > Forums > Unix > Awk to edit field in file

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Awk to edit field in file

Reply to Message Icon

Name: peternguyen
Date: October 14, 2009 at 05:25:37 Pacific
OS: Windows XP
Subcategory: General
Comment:

How can i edit a field in a file (saving the changes in the file) using awk. I can find the line that i want to edit by looking up field 1, but on that line, i don't know how to edit field 2 and save change to file.



Sponsored Link
Ads by Google

Response Number 1
Name: tvc
Date: October 23, 2009 at 09:06:43 Pacific
Reply:

echo one two | awk ' { print $1 "$newval" } '

The command before the pipe-sign is the command you say will result in that first line of the file


0
Reply to Message Icon

Related Posts

See More






Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Awk to edit field in file

getting awk to print name of file www.computing.net/answers/unix/getting-awk-to-print-name-of-file-/7206.html

align fields in columns www.computing.net/answers/unix/align-fields-in-columns/5637.html

Using awk to list links in a file www.computing.net/answers/unix/using-awk-to-list-links-in-a-file/7804.html