Please tell me why this program is not working? Help me improve it.
In $ i (seq 2 30); Do awk '{if ($ i & lt; 0.05) Print $ 1, $ i}' test.txt & gt; Phen_ $ i.txt; The file test.txt looks like the following:
name phen1 phen2 rs549 0.02 0.02 rs699 0.03 0.03 rs701 1 1 rs751 0.449 0.449 rs884 1 1 rs923 0.9775 0.02 rs970 0.9836 0.03 rs1085 0.0001 0.99 rs1220 0.9316 0.9316 There is a possibility of having two separate files according to the output file, respectively, which are 1 and call 2, and call 1 and call respectively 3 containing phen_2.txt and phen_3.txt if the situation is. Expected results for phen_2.txt: Expected results for phen_3.txt
rs549 0.02 rs699 0.03 rs1085 0.0001
rs549 0.02 rs699 0.03 rs923 0.02 rs970 0.03 Please help!
for ((i = 2; i Use variable passing ( -v ) to get the shell variable in the AWK script. You Seq . Edit: Some very quick and bad errors were fixed in my part.
Within AWK, one can do the same thing:
awk '{for (i = 2; i & lt; = 30; i ++) {If ($ i & lt; 0.05) {Print $ 1, $ I & gt; "Phen_" i ".txt"}}} test.txt It goes through the input file only once, but through the set of output files for each line of input From this cycle happens. Shell version reads the input file repeatedly, but writes every output file once.
Comments
Post a Comment