Quote:
Originally Posted by ali560045
need help in a command. My requirement is that i m grepping the filename based on a pattern in .tar.gz file and then copying the file into some dir
below is what exactly i want to achieve
step 1: grep -l '30017A6800022D1A' CurrentCollectorMeterReadBackup20081007.tar.gz
step 2: file found should be copied to dir nav/files
How to achieve the above steps without unzipping the file ? Plz help me in this
|
Code:
zcat CurrentCollectorMeterReadBackup20081007.tar.gz | grep -l '30017A6800022D1A' && cp CurrentCollectorMeterReadBackup20081007.tar.gz nav/files/
However, I'm not sure if you want to copy a FILE named 30017A... or the file CONTAINING this. Either way, you need to put this into a loop which tests against either each file in the directory, or each record that will be matched.