Skip to content

Instantly share code, notes, and snippets.

@philippgeisler
Created July 16, 2015 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save philippgeisler/6bc9e6b82c33c02baec3 to your computer and use it in GitHub Desktop.
Save philippgeisler/6bc9e6b82c33c02baec3 to your computer and use it in GitHub Desktop.
interactively select a column from (here: tab-)seperated value data by its title (expected to be in 1st line) and see its values; expects a (tsv) file path as 1st and only argument; requires percol https://github.com/mooz/percol
#!/bin/sh
head -1 $1 | \
tr "\t" "\n" | \
cat -n | \
percol | \
awk '{print $1}' | \
xargs -I c awk -v x=c 'BEGIN{FS="\t"}{print $x}' $1 | \
less
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment