Sed: Difference between revisions

From RoggeWiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
[[Category:Unix]]
sed - A stream editor for filtering and transforming text.
 
=====Sed Oneliners=====


===Synopsis===
sed [-n] [-e] [-f ''filename''] [input-file]
===Sed Oneliners===
Change first occurence ''ape'' in each line to ''rock''.  
Change first occurence ''ape'' in each line to ''rock''.  
  sed 's/ape/rock/'
  sed 's/ape/rock/'
Line 8: Line 9:
Delete all lines starting from the line containing ''ape'' to the line containing ''rock''.
Delete all lines starting from the line containing ''ape'' to the line containing ''rock''.
  sed '/ape/,/rock/d'
  sed '/ape/,/rock/d'
[[Category:Unix]]

Revision as of 23:27, 25 September 2010

sed - A stream editor for filtering and transforming text.

Synopsis

sed [-n] [-e] [-f filename] [input-file]

Sed Oneliners

Change first occurence ape in each line to rock.

sed 's/ape/rock/'

Delete all lines starting from the line containing ape to the line containing rock.

sed '/ape/,/rock/d'