I am just not seeing what my problem is here:
FILE
Y 555381 555382 256191 . A AGCCCCCCGCGC . ALLELEID 257892 CLNDISDB MedGen CN169374 CLNDN not_specified CLNHGVS NC_000024.9 !g.555387_555397dupCCCGCGCGCCC CLNREVSTAT criteria_provided,_single_submitter CLINSIG %Likely_benign CLNVC Duplication CLNVCSO SO 1000035 GENEINFO @SHOX
X 585120 585121 265992 . C G . ALLELEID 260809 CLNDISDB MedGen C1845118,OMIM 300582,Orphanet ORPHA314795 CLNDN Short_stature,_idiopathic,_X-linked CLNHGVS NC_000023.10 !g.585121C>G CLNREVSTAT no_assertion_criteria_provided CLINSIG %Likely_benign CLNVC single_nucleotide_variant CLNVCSO SO 0001483 GENEINFO @SHOX
COMMAND & SYNTAX ERROR
awk -F '\t' '{for(i=1 i < NF;i++ && j=1 j < NF;j++ && k=1 k < NF;k++) if($i ~ /@/ && $j ~ /!/ && $k ~ /%/) {print $i"\011"$j"\011"$k}}' FILE > OUTPUT
awk: cmd. line:1: {for(i=1 i < NF;i++ && j=1 j < NF;j++ && k=1 k < NF;k++) if($i ~ /@/ && $j ~ /!/ && $k ~ /%/) {print $i"\011"$j"\011"$k}}
awk: cmd. line:1: ^ syntax error
awk: cmd. line:1: {for(i=1 i < NF;i++ && j=1 j < NF;j++ && k=1 k < NF;k++) if($i ~ /@/ && $j ~ /!/ && $k ~ /%/) {print $i"\011"$j"\011"$k}}
awk: cmd. line:1:
^ syntax error
The interpreter is not liking the semi-colon between NF;k++ and the subsequent closed parenthesis ). Aide appreciated.
Hello bgold04,
In the past, you have edited your posts and removed content after you got help. Please do not repeat that behavior. If such behavior is seen this time, your account will be suspended.
for loop
in awk is defined in the manual ( https://www.gnu.org/software/gawk/manual/html_node/For-Statement.html ) as:where are those 3 parts in your code ?
initialization: set i, j, k counters one for each of the desired word prefixes, condition: select the word prefixes @, ! and % and print them out. Go to the next line until the file is exhausted. No?
no. And awk doesn't support multi initialization in the for loop. https://www.gnu.org/software/gawk/manual/html_node/For-Statement.html
OK, back to drawing board. Thanks.
You have four subsections in your
for
loop definition, which only allows three. You are getting a syntax error on the third semi-colon. Remove the unnecessary section.Alex, it just hangs when I do this..., Pierre is right, I need another approach.
I am having difficulty understanding what this is trying to do.
Can you show what your expected output should look like, in comparison with the input?
Pairing a single line of input with the expected output would be useful.
Hi! Here is the hoped for output from the FILE given above:
Thanks, this is a beautiful thing. I would be happy to discuss the one time I did this with you privately.