Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Record separator problem

Status
Not open for further replies.

mrr

Technical User
May 3, 2001
67
US
I have a file of comma delimited text with text items quoted.
I need to use a record separator that is part of field 1 on the first line of a group of records that are related.

I have been trying to use a match on the first field using the following:
BEGIN { FS =",";
RS = ( match( $1, "^\"START_OF_RECORD\""));
OFS = ",";
}
Is my logic almost correct or is there a better way to separate these records as a group?

Here's a dummy test file I have been using:
"START_OF_RECORD","sdfsdfsdf"
"A","aaaaa",bbbbb,ccccc
"B","aaaaa",bbbbb,ccccc
"C","aaaaa",bbbbb,ccccc
"d","aaaaa",bbbbb,ccccc
"END_OF_RECORD"
"START_OF_RECORD","sdfsdfsdf"
etc........


Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top