bash - find results piped to zcat and then to head -


i'm trying search string in lot of gziped csv files, string located @ first row , thought first row of each file combining find, zcat , head. can't them work together.

$find . -name "*.gz" -print | xargs zcat -f | head -1 20051114083300,1070074.00,0.00000000 xargs: zcat: terminated signal 13  example file: $zcat 113.gz | head 20050629171845,1069335.50,-1.00000000 20050629171930,1069315.00,-1.00000000 20050629172015,1069382.50,-1.00000000  .. , 2 milion rows these ... 

though solved problem writing bash script, iterating on files , writing temp file, great know did wrong, how it, , if there might other ways go it.

you should find work:

find . -name "*.gz" | while read -r file; zcat -f "$file" | head -n 1; done 

Comments

Popular posts from this blog

c++ - How do I get a multi line tooltip in MFC -

asp.net - In javascript how to find the height and width -

c# - DataTable to EnumerableRowCollection -