I have a MySQL dump file containing several tables. I already have a SED command to extract one single table.
Now I need to know how to extract only the records associated with a specific unit_id. The format is as follows:
INSERT INTO tablename (1,999,'sometext'), (2,999,'othertext'),(3,997,'text here'),(4,123,'a string'), ...
Where 999 is the unit id (there can be multiple records for a single unit id)
My desired result is:
999,'sometext'
999,'othertext'
...
... for every entry where 999 (or any specific number I choose) appears in the second column.
I tried using sed to select the values between parentheses, like this:
sed -n 's/\((.*,999,.*)\)/\1/p' < result.sql
Where 999 is the id I'm searching for.
but it returns nothing.