Results 1 to 3 of 3
hi! how can i add a comment to specific line with sed?...
- 07-15-2010 #1Just Joined!
- Join Date
- Feb 2010
- Posts
- 28
sed question
hi! how can i add a comment to specific line with sed?
- 07-15-2010 #2Just Joined!
- Join Date
- Feb 2005
- Posts
- 14
Read the sed man page about addressing particular lines.
Code:sed '1s/xxx/yyy/'
- 07-15-2010 #3Just Joined!
- Join Date
- Jul 2010
- Posts
- 7
Or, more explicitly, if you're trying to add a comment to the end of a line, and the comment symbol is a pound, try
where "line#" above is of course the number of the line you're trying to add a comment to and should be replaced by a number.Code:sed "line#s/$/ # comment/" file1 > file2


Reply With Quote