Skip to content

Instantly share code, notes, and snippets.

@captin411
captin411 / scat.sh
Created April 10, 2011 05:14
shell function to provide "smart concatenation" to switch between cat zcat and bzcat as needed
# "smart cat" -- and an awesome acronym
# shell function which will try and use
# zcat or bzcat on the filename if provided
# add to your .bash_profile or whatever
# example: scat file1.txt file2.gz file3.bz2 | grep "something useful"
scat()
{
for FILE in $@; do
MIME=$(file -bi $FILE)
case $MIME in