Ok, I've managed to pull out most of the hair on my head over this
I want to do the opposite to what most people seem to be asking. I
have an ascii text file on my unix server and I wish to add Ctrl-M
(^M) characters to the end of each line in the file. There are no ^M
characters in the file presently.
I can do this rather easily using the following sed command,
sed -e 's/$/^M/' infile > outfile
where ^M is entered as a control character using Ctrl-V + Ctrl-M.
However, what I need to do is create a script that does not contain
the control character ^M in the sed command. I would like to use an
escape sequence for the ^M character so that my script does not
contain any control characters.
Is that possible using sed? I have seen many posts that mention it is
hard to use escape sequences in sed.
An option might be to use the translate command "tr" however I have
had no luck using this command.