I want to find out the text files(ex:.html,.txt) and binary files(ex:.jpg) from each directory. From binary files at last i need only .gif files, reamining all i have to ignore.
after getting result, I have to archive those files and needs to checkin into CVS.
find dir -type f | while read N
do
case "$N" in
*.txt | *.html )
do whatever with text file "$N"
;;
*.gif | *.jpg | *.jpeg )
do whatever with binary file "$N"
;;
* )
;;
esac
done
I saved above script with .sh and ran after that getting error "scrip.sh: syntax error at line 5: `do' unexpected"
in above script "N" means what, i guess its referring to dir path right? if its referring to dir path then where to mention path.
suppose, now i am in /home/coreadmin, now i have to check files from here, then how to mentation path in above script.
first of all i ahve to findout the binary and test files, for that you given below script, after running i am getting error "scrip.sh: syntax error at line 5: `do' unexpected"
find dir -type f | while read N
do
case "$N" in
*.txt | *.html )
do whatever with text file "$N"
;;
*.gif | *.jpg | *.jpeg )
do whatever with binary file "$N"
;;
* )
;;
esac
done
one more doubt is "while read N" means what? here N referring to what?