TECH I need a hand with a Regular Expression...

jdw

New Member
Dec 31, 2005
4,413
ND
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)
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
^([^|]*\|){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.
 

SLED

custom title
Sep 20, 2001
28,048
why not bulk load it into the database, then delete the rows you don't need?

or load the data into a temp table then just 'select' the data over to the table you need it in, excluding the rows you don't want
 
TS
TS
jdw

jdw

New Member
Dec 31, 2005
4,413
ND
why not bulk load it into the database, then delete the rows you don't need?

or load the data into a temp table then just 'select' the data over to the table you need it in, excluding the rows you don't want

loading everything in the table and then deleting rows leaves us with the risk that the data we don't want gets indexed by our search appliance. A temp table might be an option but it triples the number of queries I end up running. Would be interesting to benchmark to see which is more expensive.
 

Users who are viewing this thread

About Us

  • Please do not post anything that violates any Local, State, Federal or International Laws. Your privacy is protected. You have the right to be forgotten. Site funded by advertising, link monetization and member support.
OT v15.8.1 Copyright © 2000-2022 Offtopic.com
Served by fu.offtopic.com

Online statistics

Members online
357
Guests online
38
Total visitors
395

Forum statistics

Threads
369,586
Messages
16,897,223
Members
86,875
Latest member
Theodor