Modify an exact line number of a text file and add certain string after the end of the line

Posted by Werner on Stack Overflow See other posts from Stack Overflow or by Werner
Published on 2010-03-25T17:11:14Z Indexed on 2010/03/25 17:13 UTC
Read the original article Hit count: 136

Filed under:

Hi,

given a plain text file, how can I do, using bash, awk, sed, etc, to, at the line number NLINE, add the string STR, just n spaces after the end of the line?

So, for instance, if this is the line NLINE:

date march 13th

for 5 spaces, we get

date march 13th     STR

and one gets the modification in a new file.

Thanks

© Stack Overflow or respective owner

Related posts about bash