User Tools

Site Tools


linux:sed

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
Last revisionBoth sides next revision
linux:sed [2018/09/26 17:55] percylinux:sed [2018/10/22 11:28] percy
Line 18: Line 18:
 Refer Refer
   - http://kodango.com/sed-and-awk-notes-part-5   - http://kodango.com/sed-and-awk-notes-part-5
 +
   sed '/^$/{N;/^\n$/D}'   sed '/^$/{N;/^\n$/D}'
  
 +E.g. Remove all the redundant empty lines in the Java source code
  
 +  find app/src/ -iname "*.java" -exec gsed -i '/^$/{N;/^\n$/D}' {} +
 +  
 +==== Combine every 3 lines into one line ====
 +  sed 'N;N;s/\n/ /g'
  
/var/www/dokuwiki/wiki/data/pages/linux/sed.txt · Last modified: 2018/10/22 11:31 by percy