interdimensionalmeme to Linux · 10 hours agozcat shouldn't error out if you try to zcat an uncompressed file, it should just output the damned file !message-squaremessage-square9fedilinkarrow-up153arrow-down15file-text
arrow-up148arrow-down1message-squarezcat shouldn't error out if you try to zcat an uncompressed file, it should just output the damned file !interdimensionalmeme to Linux · 10 hours agomessage-square9fedilinkfile-text
minus-squareallywilsonlinkfedilinkarrow-up14·10 hours agoYeah, it’s a pain. Leads to bad one liners: for i in $(ls); do zcat $i || cat $i; done
minus-squareMonkderViertelinkfedilinkarrow-up7·edit-23 hours agoThat’s really bad. zcat ./* 2>/dev/null || cat ./* does the same. Btw, don’t parse ls. Use find |while read -r instead.
minus-squareinterdimensionalmemeOPlinkfedilinkarrow-up6·edit-210 hours agoThanks ! But still we shouldn’t have to resort to this ! Also, can’t get the output through pipe for i in $(ls); do zcat $i || cat $i; done | grep mysearchterm this appears to work find . -type f -print0 | xargs -0 -I{} sh -c 'zcat "{}" 2>/dev/null || cat "{}"' | grep "mysearchterm" Still, that was a speed bump that I guess everyone dealing with mass compressed log files has to figure out on the fly because zcat can’t read uncompressed files ! argg !!! for i in $(ls); do zcat $i 2>/dev/null || cat $i; done | grep mysearchterm
Yeah, it’s a pain. Leads to bad one liners:
for i in $(ls); do zcat $i || cat $i; done
That’s really bad.
zcat ./* 2>/dev/null || cat ./*
does the same.Btw, don’t parse ls. Use
find |while read -r
instead.Thanks !
But still we shouldn’t have to resort to this !
Also, can’t get the output through pipefor i in $(ls); do zcat $i || cat $i; done | grep mysearchterm
this appears to workfind . -type f -print0 | xargs -0 -I{} sh -c 'zcat "{}" 2>/dev/null || cat "{}"' | grep "mysearchterm"
Still, that was a speed bump that I guess everyone dealing with mass compressed log files has to figure out on the fly because zcat can’t read uncompressed files ! argg !!!for i in $(ls); do zcat $i 2>/dev/null || cat $i; done | grep mysearchterm