#!/bin/bash
#
# Strip tabs characters from a file and replace them with 4 spaces
#
# syntax: striptabs filename [-quiet]
#

# check input parameter
if [ -z "$1" ]; then
    echo "syntax: striptabs filename [-quiet]"
    exit
fi

# input file
input=$1

# convert tabs to spaces
temp=.striptabs
tr '\t' '    ' < $input > $temp
mv $temp $input

# print some output if not quiet
if [ "$2"!="-quiet" ]; then
    echo "stripped tabs from $input"
fi
