I noticed today.
We can edit Mac's clipboad directly by pbcopy and pbpaste commands combination.
pbpaste | sed 's/Bob//g' | pbcopy
pbpaste
stdout text in clipboardsed
get stdin, edit it and stdoutpboaste
get edited text from stdin
echo "AliceBobCarol" | pbcopy && pbpaste | sed 's/Bob//g' | pbcopy && pbpaste
AliceCarol
Use gsed
command.
Because mac default 'sed' command is too poor can not use regex.
$ brew install gnu-sed
$ echo "AliceAliceBobCarol" | pbcopy && pbpaste | gsed --regexp-extended 's/^(Alice)+//g' | pbcopy && pbpaste
BobCarol
You got a new clipboard text and can paste to any place.
When missed replace, clipboad text will be runexpected.(obvious thing)
If improve this method, I should change command. For example create temporary file, make that chained command to one command.
Alfred's clipboad extension is very nice tool. You can keep clipboad history and paste them anytime.
- Mac OS X High Sierra