I have a huge mysql dump that I'm using sed to delete unneeded rows (very much faster than deleting from table) and each line of the dump is in the format
INSERT INTO table_name VALUES ("somevalue", 0), ("anothervalue", 90), ("nospaces", 67), ("another", 0) ... ;
I only need rows with the 0 integer value, so I use this expression:
sed -i 's/, ("[^ ]*", [1-9][0-9]*)//g' dump.sql
However, this doesn't match the very first row (see the comma in the expression) .. Is there anyway I can match either the comma in the beginning or end, but not both?
[[:blank:]]
in place of a space in your regex.