Skip to content

Instantly share code, notes, and snippets.

@hanminghui
Last active December 28, 2019 04:13
Show Gist options
  • Select an option

  • Save hanminghui/5e6148ad5527bf01925701d002d38b08 to your computer and use it in GitHub Desktop.

Select an option

Save hanminghui/5e6148ad5527bf01925701d002d38b08 to your computer and use it in GitHub Desktop.
[sed_scripts] some sed scripts examples #sed #linux #shell
# replace blank line, even line contains spaces
s/^ *$/.LP/
# replace spaces at begin of the line
s/^ *//
# replace spaces at end of the line
s/ *$//
# replace spaces more than one to just one space
s/ */ /g
# extract outline from latex files
sed -n '
s/[{}]//g
s/\\section/ A. /p
s/\\subsection/ B. /p' $*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment