I have a long file originally created with vi but at some point saved with MS Word. At another time I substituted all occurrences of ^M with XXX. Now I'd like to get this back to vi but with the XXX converted to newline.
It removes one occurrence in a line, I suppose you have one occurrence of XXX at the end of the line?
I'm not shure I understand what you're trying to achieve. Do you want to convert the file to dos/windows format?
Removal is not a problem. The only file I have has one line with >400,000 characters. Where ^M was at one time now has XXX but this is still all on one line.
I need to insert a carriage return at every instance of ^M.
tr, awk, or simply substitution with vi will work but I'm not using the proper syntax to get a carriage return or newline.
***********
Just tried a few more and one worked!!
within vi....
:%s/XXX/\r/g
changed them all.
I would not have thought of trying \r had I not seen that in your awk statement.