Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/bin/sh
- # 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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement