Sha256: e451291b40bbc495aabef4e0be9d51be006b1d4b52dc53677b27f2a25d9f4269
Contents?: true
Size: 645 Bytes
Versions: 17
Compression:
Stored size: 645 Bytes
Contents
#!/usr/bin/bash # NAME # strip-comments - Remove comments from postgres files # # USAGE # strip-comments [FILE] # # DESCRIPTION # Remove comments and blank lines from standard intput or the given file and # write the result on standard output # # REFERENCES # https://stackoverflow.com/a/35708616/1745001 # PROGRAM=$(basename $0) USAGE="[FILE]" function error() { echo "$PROGRAM: $@" echo "Usage: $PROGRAM $USAGE" exit 1 } >&2 [ $# -le 1 ] || error "Illegal number of arguments" FILE=$1 sed '/^\s*--/d' $FILE \ | sed 's/a/aA/g; s/__/aB/g; s/#/aC/g' \ | gcc -P -E -ansi - \ | sed 's/aC/#/g; s/aB/__/g; s/aA/a/g'
Version data entries
17 entries across 17 versions & 1 rubygems