How to make the cut command read a column after logical statements are meet?

Hi,

I want to write a code that will cut everything that is under a couple of columns in a text file but so far I am not even close to achieve something like that.

Basically, I want to cut all the information from the columns and transfer the column information to a spread sheet.

I have the solution in my mind, but in computer logic it is harder.

The solution is:

If (delimiter = ITEM) then cut 1-6
if (delimiter = DESCRIPTION) then cut 8-37
if (delimiter = PRICE) then cut 39-47

and so on...

If you think there is an easier way to transfer the information in the columns to a spread sheet please let me know.

Thank you!

Here is an example of using -i -d or -p script args to control what is cut. Example usage would be get_field -i item.csv

#!/bin/bash
while getopts idp opt 2> /dev/null
do
    case $opt in
        i) CUT_ARGS=" -c 1-6" ;;
        d) CUT_ARGS=" -c 8-37" ;;
        p) CUT_ARGS=" -c 39-47" ;;
        *) echo "Illegal option" >&2
           exit 2
        ;;
    esac
done
shift $((OPTIND-1))

if [ -z "$CUT_ARGS" ]
then
    echo "Must specify one of -i -d or -p" >&2
    exit 3
fi

if [ $# -ne 1 ]
then
    echo "Must specify output file" >&2
    exit 4
fi

cut $CUT_ARGS new.txt > $1