bigbash
bigbash copied to clipboard
Add pretty print options
trafficstars
It would be nice of the resulting bash commands could be pretty printed.
E.g.:
(trap "kill 0" SIGINT; export LC_ALL=C; curl -s -N "http://some.tld/data" | tail -n+2|awk -F',' '{q=0; o=""; for (i=1; i<=NF; i+=1) {if (q) o=o","$i; else o=o"\t"$i; if ($i == "\"") q=1-q; else{ if (substr($i,length($i),1)=="\"") q=0; else if (substr($i,1,1)=="\"") q=1; }}gsub(/\"/,"",o); print substr(o,2)}'|cut -d $'\t' -f1,3,8|awk -F '\t' '($3 > 0.97) {print}'|awk -F '\t' '{print $1"\t"$2}')
Pretty print version:
(
trap "kill 0" SIGINT; \
export LC_ALL=C; \
curl -s -N "http://some.tld/data" \
| tail -n+2 \
| awk -F',' '{q=0; o=""; for (i=1; i<=NF; i+=1) {if (q) o=o","$i; else o=o"\t"$i; if ($i == "\"") q=1-q; else{ if (substr($i,length($i),1)=="\"") q=0; else if (substr($i,1,1)=="\"") q=1; }}gsub(/\"/,"",o); print substr(o,2)}' \
| cut -d $'\t' -f1,3,8 \
| awk -F '\t' '($3 > 0.97) {print}' \
| awk -F '\t' '{print $1"\t"$2}'
)
When using a VCS a pretty printed command can be easily compared in comparison to a one line bash command.
Hi @dol: I noticed that you didn't get a response to this. Are you still interested in BigBash? Would you like to submit a PR?