bash - Adding text to a bunch of files -
i needed append text bunch of files in directory, thought i'd clever , try this:
find . -name "*.txt" -exec cat source >> {} \;
which did not work, of course, because redirect gets picked shell calling find, , not exec.
i ended using bbedit , multi-file find/replace it, sure there's way make find command line, what?
well, ok, can think of 1 solution, don't it: have exec spawn shell each result. might work.
what :
find . -name "*.txt" -exec dd if=source of='{}' oflag=append conv=notrunc ';'
you should able use files spaces , special characters.
Comments
Post a Comment