Skip to content

Instantly share code, notes, and snippets.

@NiltonVolpato
Created January 24, 2018 00:41
Show Gist options
  • Select an option

  • Save NiltonVolpato/7586a014ea05d8874c2fa7ff40acf857 to your computer and use it in GitHub Desktop.

Select an option

Save NiltonVolpato/7586a014ea05d8874c2fa7ff40acf857 to your computer and use it in GitHub Desktop.
- this will be copied to output
- also copied to output
this first line will print a blank line
this line will be ignored
also ignored
- copied to output
- copied to output too
print a blank line
ignored. and so is the blank line below
- copied
@NiltonVolpato
Copy link
Author

$ awk '{ if (/^-/) { print; block = 1 } else { if (block) { print "" }; block = 0 } }' input.txt
- this will be copied to output
- also copied to output

- copied to output
- copied to output too

- copied

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment