Hi Gurus,
i have 8 zipped files and each file is having more than 100,000 records or more.
files names :- filename_20120301.gz
filename_20120302.gz
filename_20120303.gz
filename_20120304.gz
Ex:- filename_20120301.gz
Deptno ename sal
10 Alpha 900
20 Bravo 1200
30 Charlie 1000
40 Delta 900
50 Echo 800
60 Foxtrot 1100
70 Golf 1200
80 Hotel 1500
90 India 1300
issue :-
i want to search the missing text from each zipped files
i have stuck here, the below command works fine if i give the value 10 for the deptno.
if i have more than 1 records 20,30,40,50,60 to search in .gz file
Please share the solution for this
Thanks in advance
maybe you can try 'egrep'.
egrep 'text1|text2'
thanks dude,
actually i have tried in grep, but i have no luck on this.
now its working fine by giving the
can you please share the "file name" to be print too...
guess you will be using a script to iterate through unknown list of zipped files.
it is possible to use command in a loop with 'for'. for filename in $(ls /thePath/*.gz) ...
in this loop it is possible to assign result of a command to a variable. yourVar=$(gunzip -c $filename | egrep 'txt1|txt2')
now you can check if '$yourVar' is empty or not and echo filename and result of 'egrep'.
see the man zgrep ("1") command
methyl
March 21, 2012, 8:09am
6
Personally I don't understand this sentence.
Please post Expected Output to match your Sample Data.
If you only want to match on the Deptno
field, the egrep
(or if you have the command zegrep
) needs to be more specific or you will get accidental matches with other fields.
zegrep doesnt work in my Bash.. Can any one throw some light on getting it in my bash shell???
Please help, i have a similar kinda requiremant.
Thanks,
Mahi