I want to do this:
cat myFile | sed -e "s/[ ]*CTRL-M/\n/g" > myFileCleaned
where Ctrl-M is character 0x013 and \n is a newline.

I have a file that has many, many, many long lines, each with many sets of data, each set being separated by many spaces, each instance of which is ended by character 0x013, kinda like:
data   ^Mdata   ^Mdata   ^Mdata   ^Mdata   ^M
but the spaces before the ^M are about 77 in number (seems to be consistent), and the data strings are longer, containing several elements, each separated by either one, two, or three spaces. If I can match on any number of spaces ("[ ]*") which are immediately followed by 0x013 (^M) and replace each instance with a newline, I'll be set (almost certainly).

I think I recall \n being the equivalent of a newline, although I may be confusing things with my brief venture into perl.

I did man regexp, but didn't find what I wanted. I'm not sure where else to look.

I'm sure that vim could probably do it, but I have already found that trying to search for specific things in that complexity is like looking for a tiny stainless steel needle in a humongous haystack. Magnets won't do me any good.

I have already had dealings with sed and regexp, and figured this would be a good opportunity to pick up a new trick.

TIA


--
KPLUG-List@kernel-panic.org
http://www.kernel-panic.org/cgi-bin/mailman/listinfo/kplug-list

Reply via email to