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
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