User Tools

Site Tools


docs:tips_n_tricks:sed.html

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
docs:tips_n_tricks:sed.html [22.02.2011 17:09 CET] peterdocs:tips_n_tricks:sed.html [22.02.2011 17:16 CET] (current) peter
Line 5: Line 5:
  
   sed -n '1h;1!H;${g;s/\n //g;p;}' /tmp/ldap_schema.ldif > /tmp/ldap_schema_longline.ldif   sed -n '1h;1!H;${g;s/\n //g;p;}' /tmp/ldap_schema.ldif > /tmp/ldap_schema_longline.ldif
 +
 +Meaning of the tokens:
 +
 +| ''1h''       | copy first line into hold space                   |
 +| ''1!H''      | append every line but the first one to hold space |
 +| ''${''       | execute on last line                              |
 +| ''g''        | copy hold space to pattern space                  |
 +| ''s/\n //g'' | delete newline + space                            |
 +| ''p''        | print pattern space                               |
  
 Thanks to Austin Matzko for giving a [[http://austinmatzko.com/2008/04/26/sed-multi-line-search-and-replace/|working example]]. Thanks to Austin Matzko for giving a [[http://austinmatzko.com/2008/04/26/sed-multi-line-search-and-replace/|working example]].
 +
docs/tips_n_tricks/sed.html.txt · Last modified: 22.02.2011 17:16 CET by peter

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki