removing end of line mark with sed

Mike Jetzer jetzer at studsys.mu.edu
Tue Aug 21 09:53:01 AEST 1990


In article <1990Aug19.194911.16628 at fs-1.iastate.edu> spam at iastate.edu (Begley Michael L) writes:
>How do I remove the end of line marker from a stream?  for example,
>if I have a stream that esentially looks like:
>1
>2
>3
>how do I make it into:
>1   2   3

Try tr(1):

tr \\012 " " < file

Will replace all newlines (linefeeds, octal 012) with a space.  Replacing
linefeeds with tabs or some other character is left as an exercise.

If you want more than one space (as your example seems to show), you
can run the output of tr through sed or awk or whatever.

-- 
Mike Jetzer
"And we'll have fun, fun, fun until Daddy takes the keyboard awa-ay..."



More information about the Comp.unix.questions mailing list