![]() |
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 |
| shell scripting | vijray27 | Shell Programming and Scripting | 4 | 02-27-2009 09:44 AM |
| Shell scripting | jack00423 | Shell Programming and Scripting | 1 | 09-30-2008 12:48 AM |
| difference between AIX shell scripting and Unix shell scripting. | haroonec | Shell Programming and Scripting | 2 | 04-12-2006 08:12 AM |
| Shell scripting | dipanrc | Shell Programming and Scripting | 4 | 10-27-2005 03:53 AM |
| something else on shell scripting | master_6ez | Shell Programming and Scripting | 1 | 11-21-2004 11:42 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
need a help in shell scripting
Hi Folks,
I need a help in shell scripting. I have a CSV file which got 1000 records in it..here it goes KRW71,GAMDE1,D,14656,17909.5,20090217,48324,20090202,22060,K,23897,,,,2,Truck,27.2,,,O,T KRW71,GAMDE1,D,14656,17909.5,20090217,48325,20090203,22060,K,10430,,,,1,Truck,13.6,,,O,T KRW71,GAMDE1,D,14656,17909.5,20090217,48326,20090204,22060,K,20376,,,,2,Truck,27.2,,,O,T KRW71,GAMDE1,D,14656,17909.5,20090217,48327,20090205,22060,K,19338,,,,1,Truck,13.6,,,O,T KRW71,GAMDE1,D,14656,17909.5,20090217,48328,20090206,22060,K,20682,,,,1,Truck,13.6,,,O,T I want to add a tag FBINV at the beginning of each line if its not present already. Can you please help me out in writing a script for above one. Any help would be apptreciated. Thanks in advance |
|
||||
|
Code:
# awk '!/^FBINV/{print "FBINV,"$0}' file
FBINV,KRW71,GAMDE1,D,14656,17909.5,20090217,48324,20090202,22060,K,23897,,,,2,Truck,27.2,,,O,T
FBINV,KRW71,GAMDE1,D,14656,17909.5,20090217,48325,20090203,22060,K,10430,,,,1,Truck,13.6,,,O,T
FBINV,KRW71,GAMDE1,D,14656,17909.5,20090217,48326,20090204,22060,K,20376,,,,2,Truck,27.2,,,O,T
FBINV,KRW71,GAMDE1,D,14656,17909.5,20090217,48327,20090205,22060,K,19338,,,,1,Truck,13.6,,,O,T
FBINV,KRW71,GAMDE1,D,14656,17909.5,20090217,48328,20090206,22060,K,20682,,,,1,Truck,13.6,,,O,T
|
|
||||
|
Its working dariyoosh.
Many thanks. |
| Sponsored Links | ||
|
|