Skip to content

Instantly share code, notes, and snippets.

@nh13
Created August 9, 2020 19:01
Show Gist options
  • Save nh13/de7b707a280f6e6a996b9683233341bf to your computer and use it in GitHub Desktop.
Save nh13/de7b707a280f6e6a996b9683233341bf to your computer and use it in GitHub Desktop.
# Delimited-data files: no empty columns please
function columnit { column -t $1 | less -S; }
function tabit { column -t -s $'\t' $1 | less -S; }
# Delimited-data files: empty columns values are nasty
function columnit-empty { cat $1 | sed -E 's_'$'\t'$'\t''_'$'\t''NA'$'\t''_g' | column -t | less -S; }
function tabit-empty { cat $1 | sed -E 's_'$'\t'$'\t''_'$'\t''NA'$'\t''_g' | column -t -s $'\t' | less -S; }
# Show me the money grep, now
function grep-nobuff { gstdbuf -o0 grep $@; }
# For Picard metric files
function looksee { head -8 $1 | tail -2 | column -t | less -S; } # single row
function looksee2 { tail +7 $1 | column -t | less -S; } # multi-row
# See some progress taring up your data
function tarball { tar cf - $1 -P | pv -s $(($(du -sk $1 | awk '{print $1}') * 1024)) | gzip > $2; }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment