awk功能不完全。
Tofloor
poster avatar
MrRice
deepin
2014-01-07 20:52
Author
系统版本: Linux Deepin 2013
问题:awk复杂功能无法运行。
运行代码:awk 'BEGIN{OFS="\t";FS="\t"}ARGIND==1{a[$1]=$2;}ARGIND==2{print $0a,[$1];}' test1 test2

运行该行代码,awk并不输出结果,换到其他linux版本可正常运行。
测试文件
test1
general_event_id        article_id
33192948        PMCID: PMC3034019
35789562        PMCID: PMC3003327
35789606        PMCID: PMC3003327
51221413        PMID: 15010462
1999220        PMID: 16431954
1999237        PMID: 16431954
4793645        PMID: 18327405
4793648        PMID: 18327405
5486188        PMID: 9502078

test2
general_event_id        source_entrezgene_id        target_entrezgene_id        confidence        negation        speculation        coarse_type        coarse_polarity        refined_type        refined_polarity
33192948        23        1        -1.45498        0        0        Regulation        Unspecified        Regulation        Unspecified
35789562        7408        1        -1.88247        0        0        Regulation        Positive        Regulation        Positive
35789606        7408        1        -2.17765        0        0        Regulation        Unspecified        Regulation        Unspecified
51221413        3569        1        -0.488791        0        0        Regulation        Unspecified        Catalysis of phosphorylation        Unspecified
1999220        1316        2        -1.06222        0        0        Regulation        Positive        Regulation        Positive
1999237        1316        2        -1.17409        0        0        Regulation        Unspecified        Regulation        Unspecified
4793645        1401        2        -0.450103        0        0        Regulation        Positive        Regulation        Positive
4793648        1401        2        -1.28857        0        0        Regulation        Negative        Regulation of expression        Negative
5486188        5340        2        -1.56376        0        0        Regulation        Positive        Regulation of expression        Positive

初次发帖,如有差错请原谅。LD使用很舒服,实在不想更换,但是这种基本的linux shell命令出问题实在是太不方便。希望各位大神提供解决办法。
Reply Favorite View the author
All Replies
poloshiao
deepin
2014-01-07 21:09
#1
awk 功能不完全。
1. awk 指令 指向 mawk
1-1. sudo ls -al /usr/bin/awk
/usr/bin/awk -> /etc/alternatives/awk
1-2. sudo ls -al /etc/alternatives/awk
/etc/alternatives/awk -> /usr/bin/mawk
1-3. sudo ls -al /usr/bin/mawk
/usr/bin/mawk

2. man awk
NAME
mawk - pattern scanning and text processing language
... 以下略

3. 參閱 mawk manpage
http://manpages.ubuntu.com/manpages/rar ... awk.1.html

4. 建議 以後 直接使用 mawk 使用方法 參考上面的 manpage
Reply View the author