Skip to content

Instantly share code, notes, and snippets.

@nathancahill
Created May 23, 2019 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nathancahill/324a999d6aa5a22aaa5a4b4fa36ad5a9 to your computer and use it in GitHub Desktop.
Save nathancahill/324a999d6aa5a22aaa5a4b4fa36ad5a9 to your computer and use it in GitHub Desktop.

Batch Edit Multi-selection

Useful bash commands for editing the text on each line of a multi-line selection in Sublime Text. Copy selections to the clipboard, run the command, paste modified selections back in the document.

Math

Math with numbers, adds +1 to each and evaluates it with bc:

pbpaste | sed 's/$/+1/' | bc | perl -pe 'chomp if eof' | pbcopy

Uppercase

First letter to uppercase:

pbpaste | perl -lpe's/^(.*)/\U$1/' | perl -pe 'chomp if eof' | pbcopy

Lowercase

First letter to lowercase:

pbpaste | perl -lpe's/^(.*)/\L$1/' | perl -pe 'chomp if eof' | pbcopy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment