Reputation: 2559
Good day to all,
Today, I was wondering how to introduce a character at the end of specific line.
Intial line: (The number corresponds to the line number. But, it is not part of the file)
...
101 ...
102 a,b,c,d
103 ...
...
Line what I want:
...
101 ...
102 a,b,c,d,
103 ...
...
Thanks in advance for any clue
Upvotes: 1
Views: 59
Reputation: 207670
I think you want this:
sed '102s/$/fred/' file
That says "on line 102 replace the end of line with the word fred
"
Upvotes: 6
Reputation: 41460
Using awk
awk 'NR==102 {$0=$0","}1' file
This will add ,
at end of line 102
Upvotes: 6