Unix string concatination [message #60620] |
Fri, 20 February 2004 05:29 |
Kapil
Messages: 145 Registered: May 2002
|
Senior Member |
|
|
I want to add a string "my_string" at the end of every line in my flate file, say I have
1, ewew, 23232
2, dfasd, 34322
3, dfasd, 45445
4, were, 22322
Now i want to add 'my_string' for all line able at the end
1, ewew, 23232, my_string
2, dfasd, 34322, my_string
3, dfasd, 45445, my_string
4, were, 22322, my_string
how to do this.
|
|
|
Re: Unix string concatination [message #60629 is a reply to message #60620] |
Fri, 20 February 2004 20:19 |
Prasad
Messages: 104 Registered: October 2000
|
Senior Member |
|
|
Hi Kapil
Actually this question get into unix forum questions
U can do several ways
Using sed
sed 's/$/,Kapil/g' 1 > 2
Where 1 is input file name 2 is output file name
or using vi editior. Type
:/$/s//,Kapil/g
Then save changes in file and close
or using awk
awk '{print $0,"Kapil"}' 1 > 2
Hope this answeres U'r question
Regards
Prasad
|
|
|
|