I have three questions-
1) is there any way to eliminate these messages ?
2) is there any way to search in those files as well ?
3) is there any different approach to search for a string in a heap of files ( apart from sed)
you can redirect STDERR to /dev/null thus text grep string files 2>/dev/null
If you have an account with the right to read them, issue the command from that account
grep is about the fastest string search available, however your approach will eventually result in a "Too many arguments" failure, you should try grep -r or using a command to isolate the files you need to search, eg. text find ./ -type f -name *.pl | xargs grep 'use strict' 2>/dev/null
# First eliminate errors from directories which you cannot read
# Then check that you can read each file before using grep
find . -type f -print 2>/dev/null | while read FILENAME
do
if [ -r "${FILENAME}" ]
then
grep "string" "${FILENAME}"
fi
done