$ awk 'BEGIN { OFS=FS } $8 == "No" { next } { tmp = $7 } NR > 2 { $7 -= prev } { prev = tmp; print }' inputfile
NAME PROBE GENE SYMBOL GENE_TITLE RANK IN GENE LIST RANK METRIC SCORE RUNNING ES CORE ENRICHMENT
row_0 WRAP53 null null 163 1.5818238258361816 0.08495288 Yes
row_1 NHP2 null null 201 1.5055444240570068 0.0911097 Yes
row_2 POLA1 null null 283 1.3435969352722168 0.077145 Yes
row_3 POLD3 null null 367 1.240567684173584 0.0705168 Yes
row_4 PRIM1 null null 501 1.1049883365631104 0.0576833 Yes
row_5 RFC5 null null 557 1.0596935749053955 0.0616153 Yes
row_6 POLD1 null null 653 1.0035457611083984 0.0546261 Yes
Программа awk
, снабженная комментариями:
# Set output delimiter to input delimiter (tab, set with -F)
BEGIN { OFS = FS }
# Skip lines whose 8th column is "No"
$8 == "No" { next } # or { exit } if "No"-lines are sorted at the end.
# Save the original value in column 7.
{ tmp = $7 }
# For any row past both the header and the first data line,
# decrease column 7 by the previous row's column 7 value.
NR > 2 { $7 -= prev }
# Remember the current row's original column 7 value
# in prev and print the (possibly) modified row.
{
prev = tmp
print
}
Перенаправить вывод в файл с новым именем для его сохранения:
awk '...as above...' inputfile >outputfile