In my .bashrc file I have the following function to remove the tabs in a file.
The filename (alogt2.pl) is passed in as the $1 parameter. I get the following error:
sed: 1: alogt2.pl command a expects \ followed by text
Can someone tell me how to fix this problem? I've seen that it's some kind of problem with OS X sed, but I have to think there's a way to specify these kinds of escaped characters in a sed command, otherwise OS X sed is useless!
Any help will be greatly appreciated.
The filename (alogt2.pl) is passed in as the $1 parameter. I get the following error:
sed: 1: alogt2.pl command a expects \ followed by text
Code:
function fix_tabs()
{
if [ -z $1 ] ; then
echo
echo "SYNTAX: fix_tabs <filename>"
echo "DESCRIPTION: Replaces tabs with spaces."
echo
else
[B][COLOR="Red"]sed -i '%s/\t//g' $1[/COLOR][/B]
echo "Tabs have been replaced" replaced
fi
}
Can someone tell me how to fix this problem? I've seen that it's some kind of problem with OS X sed, but I have to think there's a way to specify these kinds of escaped characters in a sed command, otherwise OS X sed is useless!
Any help will be greatly appreciated.