UNIX in a Nutshell: System V Edition

UNIX in a Nutshell: System V EditionSearch this book
Previous: Reference: nChapter 10
The sed Editor
Next: Reference: p
 

N

[address1[,address2]]N

Append next input line to contents of pattern space; the new line is separated from the previous contents of the pattern space by a newline. (This command is designed to allow pattern matches across two lines.) Using \n to match the embedded newline, you can match patterns across multiple lines. See Example under D.

Examples

Like the Example in n, but print .NH line as well as header title:

/^\.NH/{
N
p
}

Join two lines (replace newline with space):

/^\.NH/{
N
s/\n/ /
p
}


Previous: Reference: nUNIX in a Nutshell: System V EditionNext: Reference: p
Reference: nBook IndexReference: p

The UNIX CD Bookshelf NavigationThe UNIX CD BookshelfUNIX Power ToolsUNIX in a NutshellLearning the vi Editorsed & awkLearning the Korn ShellLearning the UNIX Operating System