I don't quite understand the example given from the man find
, can anyone give me some examples and explanations? Can I combine regular expression in it?
The more detailed question is like this:
Write a shell script, changeall
, which has an interface like changeall [-r|-R] "string1" "string2"
. It will find all files with an suffix of .h
, .C
, .cc
, or .cpp
and change all occurrences of string1
to string2
. -r
is option for staying in current dir only or including subdir's.
NOTE:
- For non-recursive case,
ls
is NOT allowed, we could only usefind
andsed
. - I tried
find -depth
but it was NOT supported. That's why I was wondering if-prune
could help, but didn't understand the example fromman find
.
EDIT2: I was doing assignment, I didn't ask question in great details because I would like to finish it myself. Since I already done it and hand it in, now I can state the whole question. Also, I managed to finish the assignment without using -prune
, but would like to learn it anyway.