Last active
January 2, 2016 20:56
-
-
Save u0d7i/c03e34e57802d0b6347a to your computer and use it in GitHub Desktop.
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
Preserve file timestamp in multifile string replace | |
-I to grep ignores binary files, | |
@ in sed works as separator for strings with / | |
-r in touch uses existing file timestap as a reference | |
$ grep -IR aaaa /somepath/ | awk -F: '{print $1}' | while read line; do touch -r $line /tmp/timeref; sed -i 's@aaaa@bbbb@' $line; touch -r /tmp/timeref $line; done | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment