Created
January 5, 2022 08:37
-
-
Save thingsiplay/5c6c034e302660aa205fddc02136c2a8 to your computer and use it in GitHub Desktop.
Clipboard editing scripts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
echo '' | xclip -selection clipboard -rmlastnl -in | |
xsel --clipboard --clear |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
tmpfile=`mktemp -t clipedit.XXXXXX` | |
xclip -selection clipboard -out > "$tmpfile" | |
${VISUAL:-${EDITOR:-$( which vi)}} "$tmpfile" | |
xsel --clipboard < "$tmpfile" | |
rm -f "$tmpfile" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# clipsed SEARCH REPLACE [DELIMITER] | |
if [ "$#" -ge 3 ] | |
then | |
e="s$3$1$3$2$3g" | |
else | |
e="s^$1^$2^g" | |
fi | |
xclip -selection clipboard -out | \ | |
sed "$e" | \ | |
xsel --clipboard --input |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
s=`zenity --entry --text "search text"` | |
if [ ! -z "$s" ] | |
then | |
r=`zenity --entry --text "replace text"` | |
e="s^$s^$r^g" | |
xclip -selection clipboard -out | \ | |
sed "$e" | \ | |
xsel --clipboard --input | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment