On 02/03/14 18:52, Mike Gilbert wrote:
On Mon, Feb 3, 2014 at 6:14 PM, Joseph <syscon...@gmail.com> wrote:
I have a text file. How do I search and replace "carriage return"?
Do you mean carriage return (decimal 13) or line feed (decimal 10)?
The former is pretty simple:
sed -e 's:\r: :g' foo.txt
OK here is the text output (last few lines) of the command: cat 15.txt | sed
's/\r$//' | od -c
...
0017460 o w t h e m a j o r g r o
0017500 u p i n g s o f \n d i n o s a
0017520 u r s . \n L e t ' s m o v e
0017540 o n f r o m d i n o s a u r
0017560 s k e l e t o n s t o \n o u
0017600 t w a r d a p p e a r a n c e
0017620 s . \n
the actual text:
ow the major groupings of
dinosaurs.
Let's move on from dinosaur skeletons to
outward appearances.
so it seems to me the carriage return is represented by: " \n"
I've tried
sed -e 's:\n: :g' 15.txt
makes no difference. How to replace the "\n" with space.
--
Joseph