I have Suse linux in my environment
I have to search certain files from a list of files (around 3000) and in each files if there are special characters(like scanidavian characters or #,$,%) than we have to print that file name.
Hello prakashapurv,
Following may help you in same, not tested though.
awk '/\$/ || /%/ || /#/ {print}' Input_file
Thanks,
R. Singh
Hi Thanks for your reply.
I should have been more clear.
For ex
I have below files
a.txt
b.txt
c.txt
d.txt
I want to search each file for the special characters and print the file containing the special characters.
I have wrote a script below.
for line in $(cat newfile2) ; do
if [[ (cat $line | grep $ ) ]]
then
echo $line
else
echo "No Files available"
fi
done
Please use code tags as required by forum Rules!
I'm not sure your code snippet will do what you want it to do
- it has a syntactical error
- it doesn't examine the files for scandinavian nor special chars (given newfile2 holds all those filenames)
To achieve what I think you want,
LC_ALL=C grep '[^[:alnum:][:space:]#$%]' *.txt
might suffice, although with 3000 files that command might exceed LINE_MAX. Use an ls
piped into a while
loop , then.