Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.
replace a newline with string
Name: raxit Date: February 28, 2003 at 07:55:27 Pacific OS: hpux CPU/Ram: 133
Comment:
hi, i need to add a string like /java at the end of each line in a file. i tried it using commands like tr '\012' '/java\012' but i think tr command only replaces a character. tried it using sed command ..but that also doesnt work. please help. thanks.
Name: neel Date: February 28, 2003 at 08:19:51 Pacific
Reply:
can you try sed 's/$/java$/g' File.EXT > file I think it will work.
0
Response Number 2
Name: anukta_c Date: February 28, 2003 at 08:21:58 Pacific
Reply:
Try sed 's/$/\/java/g' yourfilename > newfile -Anukta
0
Response Number 3
Name: neel Date: February 28, 2003 at 08:24:18 Pacific
Reply:
Yeah .. missed the \/ part.. hey Ankuta dont you think we need to put java$ rather than java ? ~ Neel !!
0
Response Number 4
Name: anukta_c Date: February 28, 2003 at 08:30:59 Pacific
Reply:
java$ will obviously work...but simply /java substitution will work as well. Though I cannot explain why. I will leave that to the Gurus of this forum. -Anukta
0
Response Number 5
Name: anukta_c Date: February 28, 2003 at 08:33:18 Pacific
Reply:
OOPS....sorry java$ substitution will not work...it will actually do a literal substitution with "java$".
-Anukta
0
Response Number 6
Name: raxit Date: February 28, 2003 at 08:39:05 Pacific
Reply:
hey , anukta and neel..my problem is solved thanks for your help.
Summary: I need to replace anything immediately after the pattern "standard01/" in a file with the value of a variable I don't know the length of the characters stored in that variable. - that might vary. I k...
Summary: Hi, I have some data which is comma delimited. How do I change it to be tab delimited? I tried sed 's/,/\t/g' but it just replaced the commas with a t. ...
Summary: Hi, I would like to replace all "mytestcase" with a variable $name. I have a for loop that reads: foreach newname ('more name_list') set name= $newname:r ...