Home » RDBMS Server » Server Administration » Unix string concatination
Unix string concatination [message #60620] Fri, 20 February 2004 05:29 Go to next message
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 Go to previous messageGo to next message
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
Re: Unix string concatination [message #60632 is a reply to message #60629] Sat, 21 February 2004 05:11 Go to previous message
Kapil
Messages: 145
Registered: May 2002
Senior Member
Thanks.
Previous Topic: Is there a limit to number of locks Oracle can hold?
Next Topic: cost based optimizer
Goto Forum:
  


Current Time: Fri Sep 20 10:23:55 CDT 2024