Last active
September 19, 2022 20:58
-
-
Save huozhi/4f4db2c892a092db0ebc66ca8865868c to your computer and use it in GitHub Desktop.
inesert text to files
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
# https://stackoverflow.com/questions/61546603/bash-find-file-and-insert-text-in-beginning-of-empty-and-non-empty-files | |
# insert `'client'\n` to all .client.tsx files | |
find . -type f -name '*.client.tsx' -print0 | while IFS= read -rd '' file; do ed -s "$file" <<< $'0a\n\'client\'\n\n.\nw\nq'; done | |
# rename files | |
ls | grep \.png$ | sed 'p;s/\.png/\.jpg/' | xargs -n2 mv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment