Search This Blog

sed: how to delete/skip empty/blank lines

  • To delete/skip the empty/blank lines:
    sed '/^$/d' inputFile
    
  • To delete/skip the lines that are empty or contain only spaces:
    sed '/^[[:space:]]*$/d' inputFile
    

No comments:

Post a Comment