Skip to content

Instantly share code, notes, and snippets.

@sinarueeger
Last active December 28, 2019 04:13
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sinarueeger/aedcdfd997e30df5941e5c529936f9c8 to your computer and use it in GitHub Desktop.
Save sinarueeger/aedcdfd997e30df5941e5c529936f9c8 to your computer and use it in GitHub Desktop.
awk/sed cheatsheet
## adding column N as last column to a file
FILE=~/gwas.txt
N=98
awk '$NF="98"' $FILE > tmp-file
sed -e '1s/98/N/' tmp-file > tmp2-file
Chr SNP bp A1 A2 Freq b se p
1 1:2189996 2189996 A AGTTTT 0.257519 0.0301362 0.0449327 0.502414
1 1:6713467 6713467 C A 0.642857 -0.0755824 0.0439458 0.0854506
1 1:767213 767213 A G 0.148496 -0.026974 0.0593651 0.64956
1 1:9059522 9059522 C T 0.174812 -0.012219 0.0548856 0.823826
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment