I have a massive number of files with extensions like
.0_4132 etc. Some of these are
gzip compressed and some are raw email. I need to determine which are compressed files, decompress those, and rename all files to a common extension once all compress files are decompressed. I've found I can use the file command to determine which are compressed, then grep the results and use
sed to whittle the output down to a list of files, but can't determine how to decompress the seemingly random extensions. Here's what I have so far
file *|grep gzip| sed -e 's/: .*$//g'
I'd like to use
xargs or something to take the list of files provided in output and either rename them to
.gz so they can be decompressed, or simply decompress them in-line.