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.
Sed:Add text to end of line in file
Name: Deepesh Date: February 21, 2007 at 22:59:55 Pacific OS: HP-UX CPU/Ram: 512MB Product: HP-UX
Comment:
Hi,
Could you help me with a sed command to add a text in all the line in a particular file ?
Apart from sed is there any other command which could achieve this ?
Name: nails Date: February 22, 2007 at 07:03:21 Pacific
Reply:
#!/bin/ksh
# add to text to end of a file using sed sed 's/$/Add Text to end"/g' myfile
# using awk awk ' { print $0"Add Text to end" } ' myfile
0
Response Number 2
Name: Deepesh Date: February 22, 2007 at 21:56:35 Pacific
Reply:
Hi,
Thanks a lot for your response !! Actually command is adding the text at the start of all the line.
What is the option to append at end of the lines ?
Thanks a lot, Deepesh
0
Response Number 3
Name: nails Date: February 23, 2007 at 08:40:52 Pacific
Reply:
I'm not understanding:
>Actually command is adding the text at the start of all the line.
The two solutions I gave you do append the text to the end of the line. In the sed example, $ is a regular expression which identifieds the end of the line.
Please elaborate or better yet, post some code and tell us where you are having a problem.
Summary: I’m trying to making a batch file that replaces a word with another in a file(s!) that containing the word. By using Edlin program. And to use edlin so req. it ^Z (Ctrl+Z) as a breaker between old t...
Summary: Hi ! I Im trying to add some text to a txt file like this: echo blablabla >>mu.txt But I dont want the text to be added in the beginning of the file. I want to add the text to a specific line in the t...
Summary: SOLUTION 1: ------------ 1. Right click on "Recipe.bat", and select "create shortcut" 2. Right click on "shortcut to recipe.bat" and select property 3. on target text box, add *.txt into end of line. ...