after using find I need to iterate the files
var=`find -name "reg"`
#replace ./ for newline
for file in $var; do
#something
done
edit: SOLVED with ${string#*/} it takes away the ./
I can survive with that I think
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
EDIT:
I am not concerned about how you get the $file, using command line or whatever suits you. I am much more concerned about the
#do somethingpart of your question, which I believe is the main question and all those who are posting variousfind -name 'reg' | xargs ...should think twice before complicating the matters for OP.use sed
remove the -i options to get output on the screen, if satisfied output is obtained use -i to actually change the line.
On second read, maybe I am replacing the other way round, perhaps you want to replace newline with ./ ? Its bit complicated
as always, test without -i option and then decide if you want to modify the file.
For explanation of second sed magic, read this SO . Its exactly same, except for the
./character for replace string.