[gnuwin32 - Help] RE: sed -n not working as expected

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.windows.gnu.user
Message-ID <[email protected]>
Read and respond to this message at: 
https://sourceforge.net/forum/message.php?msg_id=6419531
By: keithmarshall

Nope.  You need to go read the manual again.

  command | sed -n /regex/{N;p}

(if you ignore the POSIX violation of failing to place a newline before the
closing brace), should do exactly what you say it is doing, i.e. print both
the matched line, and the following line.

http://www.gnu.org/software/sed/manual/sed.html#Other-Commands
|N
|  Add a newline to the pattern space, then append the next line
|  of input to the pattern space. If there is no more input then sed
|  exits without processing any more commands. 

http://www.gnu.org/software/sed/manual/sed.html#Common-Commands
|p
|  Print out the pattern space (to the standard output). This command
|  is usually only used in conjunction with the -n command-line option. 

______________________________________________________________________
You are receiving this email because you elected to monitor this forum.
To stop monitoring this forum, login to SourceForge.net and visit: 
https://sourceforge.net/forum/unmonitor.php?forum_id=74807

------------------------------------------------------------------------------
Open Source Business Conference (OSBC), March 24-25, 2009, San Francisco, CA
-OSBC tackles the biggest issue in open source: Open Sourcing the Enterprise
-Strategies to boost innovation and cut costs with open source participation
-Receive a $600 discount off the registration fee with the source code: SFAD
http://p.sf.net/sfu/XcvMzF8H
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.