Please modify solution


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Please modify solution
# 1  
Old 02-21-2013
Please modify solution

Hi
Please check my code,here awk -vLIT="$line" '$0 ~ LIT { print LIT,"Found in ",FILENAME; }' $f it is not checking for small alphabets.can u pls modify my code

Code:
#!/bin/ksh
for f in /tmp/satemp/*
do
cat /tmp/sa/tt.txt| while read line
do
awk -vLIT="$line" '$0 ~ LIT { print LIT,"Found in ",FILENAME; }' $f
done
done

# 2  
Old 02-21-2013
Code:
awk -v LIT="$line" ' tolower($0) ~ tolower(LIT) { print LIT,"Found in ",FILENAME; }' $f

# 3  
Old 02-21-2013
Similar but much simpler, and -i makes it case insensitive:
Code:
#!/bin/ksh
egrep -i -f /tmp/sa/tt.txt /tmp/satemp/*

GNU egrep even takes
Code:
egrep -i -o -f /tmp/sa/tt.txt /tmp/satemp/*


Last edited by MadeInGermany; 02-21-2013 at 02:42 PM..
# 4  
Old 02-21-2013
Does it stop scanning the file after printing?
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

need the solution

Write a program to print all prime numbers from 1 to 300. (3 Replies)
Discussion started by: paniruddha
3 Replies
Login or Register to Ask a Question