I can't figure this one out - probably just not thinking about it the right way.
I have a pipe delimited file and I need to match only rows where the 4th field is not in a list of strings (4 digit codes)
^([^|]*\|){3}(1234|1237) matches ROW1 and ROW4 fine.
Instead I want to exclude any row with 1234 and 1237 in the 4th field.
Issue I seem to be having is getting it to treat (1234) as a string instead of a list of characters.
tried (among others)
^([^|]*\|){3}[^(1234|1237)]
^([^|]*\|){3}[^(1234)]
The project requires me to take a number of pipe delimited feed files of (up to) a couple thousand rows and dump them in a database (MySQL). Some of the feeds have rows of data that will not go in this table (determined by the list of codes) so I'm trying to use egrep to grab only the data I need, dump that to a temp file, and use MySQL's LOAD DATA to ingest it.
I have a pipe delimited file and I need to match only rows where the 4th field is not in a list of strings (4 digit codes)
Code:
ROW1|FIELD2|FIELD3|1234|FIELD5|FIELD6
ROW2|FIELD2|FIELD3|1235|FIELD5|FIELD6
ROW3|FIELD2|FIELD3|1236|FIELD5|FIELD6
ROW4|FIELD2|FIELD3|1237|FIELD5|FIELD6
Instead I want to exclude any row with 1234 and 1237 in the 4th field.
Issue I seem to be having is getting it to treat (1234) as a string instead of a list of characters.
tried (among others)
^([^|]*\|){3}[^(1234|1237)]
^([^|]*\|){3}[^(1234)]
The project requires me to take a number of pipe delimited feed files of (up to) a couple thousand rows and dump them in a database (MySQL). Some of the feeds have rows of data that will not go in this table (determined by the list of codes) so I'm trying to use egrep to grab only the data I need, dump that to a temp file, and use MySQL's LOAD DATA to ingest it.