1

I want to perform this

awk -F, '$1 ~ /F$/' file.dat

on a whole direcory of gziped files

I want to be able to loop through each file unzip it perform the above command (print out any findings) rezip and move onto the next zipped file

how can this be done?

Thanks

4

3 に答える 3

3

Well if you have to have it all in one line:

find . -name \*.gz -print0 | xargs -0 gunzip -c | awk -F, '$1 ~ /F$/'

That should work for you

于 2009-03-18T16:06:07.763 に答える
0

次のことを行うシェルスクリプトはどうですか:

gunzip $1.gz
awk -F, '$1 ~ /F$/' $1
gzip $1

拡張子$1がないことを確認してください。.gz

次に、次のようなことができます。

find -name \*.gz -type f|xargs my_shell_script
于 2009-03-18T15:32:17.033 に答える