![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | 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 here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| To cut entire column from a file and apend it to another file as another column | sakthifire | Shell Programming and Scripting | 4 | 06-25-2008 01:27 AM |
| How to check Null values in a file column by column if columns are Not NULLs | Mandab | Shell Programming and Scripting | 7 | 03-15-2008 06:57 AM |
| Finding unique reocrds at a particular field | dsravan | Shell Programming and Scripting | 7 | 12-11-2007 01:03 PM |
| cut the third column from a file | isingh786 | Shell Programming and Scripting | 8 | 12-29-2005 08:11 AM |
| Replace 10th column with a new column--- Terriblly hurry | ahmedwaseem2000 | Shell Programming and Scripting | 2 | 09-05-2005 10:10 PM |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
i want to add a new column at the end for all the reocrds in a
file for ex: file name is abc.wlg.x.y.z records like 1,2,3,4,5,6,8,y,u,8,1,2,3,4,5,6,8,y,u,8 2,3,4,5,6,8,y,u,8,1,2,3,4,5,6,8,y,u,8,k 3,4,5,6,8,y,u,8,1,2,3,4,5,6,8,y,u,8,k,l 4,5,6,8,y,u,8,1,2,3,4,5,6,8,y,u,8,u,i,o 1,2,3,4,5,6,8,y,u,8,1,2,3,4,5,6,8,y,i,u i want to add xyz for all the records into file abc.wlg.x.y.z and output like 1,2,3,4,5,6,8,y,u,8,1,2,3,4,5,6,8,y,u,8,xyz 2,3,4,5,6,8,y,u,8,1,2,3,4,5,6,8,y,u,8,k,xyz 3,4,5,6,8,y,u,8,1,2,3,4,5,6,8,y,u,8,k,l,xyz 4,5,6,8,y,u,8,1,2,3,4,5,6,8,y,u,8,u,i,o,xyz 1,2,3,4,5,6,8,y,u,8,1,2,3,4,5,6,8,y,i,u,xyz Last edited by pulse2india; 11-05-2005 at 09:36 PM. |
| Forum Sponsor | ||
|
|
|
#2
|
||||
|
||||
|
Try this:
sed 's/$/,xyz/' < inputfile > outputfile |
|
#3
|
|||
|
|||
|
If you want an in place substitution:
perl -p -i -e 's/$/,xyz/g' file_name Just a substituted output: sed 's/$/,xyz/g' file_name |
|
#4
|
|||
|
|||
|
to add columns to all the records in a file
thanks for input...
i want to change like i have to add 'xyz' in 18th position and its a comma delimeted one. Thanks in advance |
|
#5
|
||||
|
||||
|
Code:
nawk '
BEGIN {
FS=OFS=","
}
{ $17=$17 FS "xyz" }
1' inputfile
|
||||
| Google The UNIX and Linux Forums |