![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| how to specify the column(field) in sed command | jdhahbi | Shell Programming and Scripting | 4 | 01-22-2009 06:17 PM |
| ps command - time field | nhatch | UNIX for Dummies Questions & Answers | 1 | 05-12-2008 11:15 AM |
| sed command to change 2nd field | Julius | Shell Programming and Scripting | 4 | 10-08-2006 08:30 AM |
| PS Command Field | akuma | Linux | 2 | 11-08-2005 09:49 AM |
| exec command and field descriptors.. | moxxx68 | UNIX for Dummies Questions & Answers | 5 | 12-04-2004 05:58 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
where to specify the field name in SED command
HI Folks,
I know the solution to my question is very easy but i could not find it out. There is CSV file with 20 fields with 5 rows contains different data as below: FBINV,LVO71,GAMFR1,D,104164,16677.36,20090625,102135,20090529,7267,KG,,,,0,,,,DTD,,O,O,,,,,,,,,30058 8136 FBINV,LVO71,GAMFR1,D,104164,16677.36,20090625,102135,20090529,7267,KG,,,,0,,,,DTD,,O,O,,,,,,,,,30058 8136 FBINV,LVO71,GAMFR1,D,104164,16677.36,20090625,102135,20090529,7267,KG,,,,0,,,,DTD,,O,O,,,,,,,,,30058 8136 FBINV,LVO71,GAMFR1,D,104164,16677.36,20090625,102135,20090529,7267,KG,,,,0,,,,DTD,,O,O,,,,,,,,,30058 8136 FBINV,LVO71,GAMFR1,D,104164,16677.36,20090625,102135,20090529,7267,KG,,,,0,,,,DTD,,O,O,,,,,,,,,30058 8136 I want to replace KG with K in field 11th in all the rows. Can you please help me with a code to replace it in all the lines.processing line by line.There can be any number of rows in a file. thanks a lot |
|
||||
|
Code:
I want to replace KG with K in field 11th in all the rows. Bit change to lathamvim's solution : Code:
awk 'BEGIN {FS=OFS=","} $11 ~/KG/ { $11 = "K" ; print }' File_name.txt
Last edited by panyam; 07-04-2009 at 08:13 AM.. |
| Sponsored Links | ||
|
|