Hi, all
I have not used find extensively, usually because
I could do it another way with greater flexibility.
Yesterday I had a situation where it was perfect.
A number of files in various subdirectories, all named identically, needed one line changed.
Calling find I was able to do what I wanted but unable
to commit the changes in a one-liner because I could
not save finds \{\} subbed variable!
I had to do it this way:
Is there something basic I was missing?
I have not used find extensively, usually because
I could do it another way with greater flexibility.
Yesterday I had a situation where it was perfect.
A number of files in various subdirectories, all named identically, needed one line changed.
Calling find I was able to do what I wanted but unable
to commit the changes in a one-liner because I could
not save finds \{\} subbed variable!
I had to do it this way:
Code:
find $dirname -type f -name filename | xargs echo >> tmp.txt
for all in `cat tmp.txt`
do
sed 's/line1/line1againmorestuff/' $all > $tmp && mv $tmp $all
done
rm tmp.txt ; rm $tmp
Is there something basic I was missing?