I can do the following to search a file to find SQL INSERT statements:
$ cat my_sql_file.sql | grep INSERT
but I want to narrow down the search to find the the unique tables that the SQL dump is inserting into.
EDIT: I also don’t want the results sorted. I just want the results in the exact order that grep found them in :).
How can you do this?
Many thanks :).
you can use grep, awk and sort to do this. Supposing the sql for the insert is something like this:
“Insert into tablename …… ”
you can do: