How to get an entry out of a tab delimited file

Insert the following function into your .bashrc:

# Function that gets a column and row from a tab separated file
tableEntry()
{
sed -n "$1p" $3 | awk '{print $'$2'}'
}

You are then able to write

tableEntry 2 5 file.txt

to get the 2nd row and 5th column from any file.

Leave a Reply