from - to delimiter

hey guys can you please help me out,

i'm having problem in cutting strings. I need a delimiter to cut string.

sample


a.txt
"ID", "1234" , "iam bighippo", "help!"
"ID", "1235" , "again0", "xxxxxxx1"
"ID", "1236" , "again1", "xxxxxxx2"
"ID", "1237" , "again2", "xxxxxxx3"

how do i cut "1234" , "ID" , "iam bighippo" and store it into a variable?

ID="ID"
NUM="1234"
NAME="iam bighippo"

is there a function that cuts the string using delimiter? Thanks!

Check out the man pages of cut.

What I understand from the problem given below is that you are confused over using delimiters in the string.

If the string is same as what you have given , then "," can be used as a delimiter and the value can be stored in a variable as well.
Example below:

id=`cat a.txt | cut -d "," -f 1`

If "," is not something you intend to use as a delimiter, you can use space as a delimiter.Example given below:

id=`cat a.txt | tr -s " " | cut -d " " -f 1`

Hope this helps!

Thanks!
nua7

thanks for quick reply.
ok.. now how do i store it in a variable?
so far i can only store the filtered sting in a text file..

what exactly you want to store in the variable.? My eg shows how to store filtered string in the variable. Sorry but can't get your question..

what exactly are you wanting to do. ? show your output.

i got it all working now! thank you nua7!
sorry, im just a newbie in shell script.
anyway thanks for your response