Last active
June 28, 2024 11:33
-
-
Save uriel1998/37b731725653def3b675705546d14f22 to your computer and use it in GitHub Desktop.
This file contains hidden or 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/bash | |
# uses a complex sed string -- along with copyq and xclip -- to pull a selected string in and capitalize it. | |
# I use this with AutoKey. | |
# see https://ideatrash.net/2024/06/using-sed-to-capitalize-titles-and-a-tricky-escaping-problem.html for explanation | |
/usr/bin/copyq select 0 | |
/usr/bin/copyq read 0 | sed -e "s/\b\(.\)/\u\1/g" -e "s/-\(.\)/-\u\1/g" -e 's/“/"/g' -e 's/”/"/g' -e "s/’/'/g" -e 's/—/ -- /g' -e 's/ — / -- /g' -e 's/ - / -- /g' -e 's/ – / -- /g' -e 's/ – / -- /g' -e "s/"\'"\([A-Z]\)\b/"\'"\l\1/g" -e "s/"\'"\([A-Za-z][A-Za-z]\)\b/"\'"\l\1/g" | /usr/bin/copyq write 0 - | |
/usr/bin/copyq select 0 | |
/usr/bin/copyq read 0 | xclip -i | |
/usr/bin/copyq select 0 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment