awk Programming
1. General
2. awk with conditions
1. General
FS=-F : awk --help
Basic example
NR: number of rows
NF: number of fields
FS: Input field separator (options -F)
OFS: Output field separator Multiple delimiter: awk -F"\t|," (delimiter \t or ,)
Modify from outside variable of bash and awk independent
a=”sold”
Modify from outside
2. Awk with conditions (simple conditions, For loop, If loop)
Example GTF file
https://gist.github.com/decodebiology/1e7cca357e52a181dc25#file-sample-gtf
See excel file
https://www.thegeekstuff.com/2010/02/awk-conditional-statements/
https://linuxhint.com/for_loop_awk_command/
ratio=$(awk -F"\t" 'NR==1 {for (i=1;i<=NF;i++){print i,$i};exit}' bigTable.tsv | grep "087-P11.ratio" | cut -d" " -f1)
echo $ratio
ratio1=$(“command”)
echo $ratio1 (1)
ratio2=”command”
eval ratio2 (2)
(1) = (2)