[9fans] strange behavior? - Plan9

This is a discussion on [9fans] strange behavior? - Plan9 ; ##script: T = 'Eptatretus burgeri' echo $T awk '/'^$T^'/' all.uniq echo '++++++++++++++++' T=`{awk 'NR== '23' ' SpeciesList} echo $T awk '/'^$T^'/' all.uniq ## result: Eptatretus burgeri Eptatretus burgeri (complete) Metazoa; Chordata; Craniata; Hyperotreti; Myxiniformes; Myxinidae; Eptatretinae; Eptatretus. NC_002807 cox1, -S(nga), ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: [9fans] strange behavior?

  1. [9fans] strange behavior?

    ##script:
    T = 'Eptatretus burgeri'
    echo $T
    awk '/'^$T^'/' all.uniq
    echo '++++++++++++++++'
    T=`{awk 'NR== '23' ' SpeciesList}
    echo $T
    awk '/'^$T^'/' all.uniq
    ## result:
    Eptatretus burgeri
    Eptatretus burgeri (complete) Metazoa; Chordata; Craniata; Hyperotreti; Myxiniformes; Myxinidae; Eptatretinae; Eptatretus. NC_002807 cox1, -S(nga), D, cox2, K, atp8, atp6, cox3, G, nad3, R, nad4L, nad4, H, S(nct), L(nag), nad5, -nad6, -E, cob, T, -P, F, rrnS, V, rrnL, L(yaa), nad1, I, -Q, M, nad2, W, -A, -N, -C, -Y
    ++++++++++++++++
    Eptatretus burgeri
    awk: can't open file /burgeri/
    source line 1
    rc 117587: awk 117593: 2


  2. Re: [9fans] strange behavior?

    consider
    awk '/'^(a b)^'/' /dev/null

    awk: can't open file /b/
    source line 1

    your case is similar:

    T=(a b)
    awk '/'^$T^'/' /dev/null

    awk: can't open file /b/
    source line 1

    and finally

    awk '/'^$"T^'/' /dev/null

    success? note the " before the T in the last one.


  3. Re: [9fans] strange behavior?

    > ##script:
    > T = 'Eptatretus burgeri'
    > echo $T
    > awk '/'^$T^'/' all.uniq
    > echo '++++++++++++++++'
    > T=`{awk 'NR== '23' ' SpeciesList}
    > echo $T
    > awk '/'^$T^'/' all.uniq
    > ## result:
    > Eptatretus burgeri
    > Eptatretus burgeri (complete) Metazoa; Chordata; Craniata; Hyperotreti; Myxiniformes; Myxinidae; Eptatretinae; Eptatretus. NC_002807 cox1, -S(nga), D, cox2, K, atp8, atp6, cox3, G, nad3, R, nad4L, nad4, H, S(nct), L(nag), nad5, -nad6, -E, cob, T, -P, F, rrnS, V, rrnL, L(yaa), nad1, I, -Q, M, nad2, W, -A, -N, -C, -Y
    > ++++++++++++++++
    > Eptatretus burgeri
    > awk: can't open file /burgeri/
    > source line 1
    > rc 117587: awk 117593: 2


    I think this is a problem with rc treating $T as a list, and you need
    a list flattening operator (double quote).

    Perhaps what you need is

    awk '/'^$"T^'/' all.uniq

    [unsure as hasn't had any coffee yet]

    -Steve

+ Reply to Thread