a guest Jul 22nd, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
- # in DataGrip, dump rows as SQL INSERT
- # then produce more compact and readable file
- # leave only one INSERT INTO ... VALUES
- head -1 $1 | sed -r 's/(INSERT INTO \S+) (.+) (VALUES) .+$/\1\n\2\n\3/' ;
- # remove repeating INSERTs, leave only tuples separated by comma and newline
- sed -r 's/INSERT INTO \S+ \(.+\) VALUES //' $1 | sed -r 's/;$/,/'
- ) | head -c-1
- # and remove trailing comma
RAW Paste Data