tru64-unix-managers (formerly alpha-osf-managers) (1994-2012)
 help / color / mirror / Atom feed
* SUMMARY: sed (join two lines)
@ 1998-08-21  5:03 Warren, John H.
  0 siblings, 0 replies; only message in thread
From: Warren, John H. @ 1998-08-21  5:03 UTC (permalink / raw)
  To: tru64-unix-managers

Original question:

I have created a text file that contains two lines- one with a timestamp,
the other with one ping command output.  I want to join both lines (remove
the linefeed after the first line), but am having no luck.  I open the file
in vi, and attempt to use the following:
	:1,$s/1998\n/1998/	<<1998 is the last token in the line>>
Any help is appreciated

Thanks to Ian Mortimer for the quick response:

This will do it:

   sed -e '/1998/N' -e 's/\n//' file

The first edit appends the second line to the first with an
embedded newline and the second edit removes the newline.

The man page for sed states:

   The sequence \n matches a newline character in the pattern space,
   except the terminating new line.
   ^^^^^^
Which is why you're command didn't work.


John H. Warren

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~1998-08-21  5:03 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1998-08-21  5:03 SUMMARY: sed (join two lines) Warren, John H.

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox