I'm trying to split a tab delimitted field in bash.
I am aware of this answer: how to split a string in shell and get the last field
But that does not answer for a tab character.
I want to do get the part of a string before the tab character, so I'm doing this:
x=`head -1 my-file.txt`
echo ${x%*}
But the is matching on the letter 't' and not on a tab. What is the best way to do this?
Thanks
question from:https://stackoverflow.com/questions/6654849/how-to-split-a-string-in-bash-delimited-by-tab