在新列中打印大写字母
Print uppercase occurrence in new column
"file1.txt" 看起来像这样:
_1ss4TG actaaAAAACAAGTAAGCGTAATTCCTCCtagataataaaTTTACTAGTtata
osa-miR5523_L-1R+1 actaaAAAACAAGTAAGacatGAGGAGGAACATATTTACTAGTtata
ath-miR156a-5p ggaggTGACAGAatgcgtgctcaccctctatctgtcaccccc
我想在第三列中打印出现的大写字母,因此它看起来像这样:
_1ss4TG actaaAAAACAAGTAAGCGTAATTCCTCCtagataataaaTTTACTAGTtata 33
osa-miR5523_L-1R+1 actaaAAAACAAGTAAGacatGAGGAGGAACATATTTACTAGTtata 34
ath-miR156a-5p ggaggTGACAGAatgcgtgctcaccctctatctgtcaccccc 7
我已经尝试过使用 grep 和 awk,但我没弄对。
awk '{NF+=1;=length(gensub("[a-z]","","g",))}1' b
_1ss4TG actaaAAAACAAGTAAGCGTAATTCCTCCtagataataaaTTTACTAGTtata 33
osa-miR5523_L-1R+1 actaaAAAACAAGTAAGacatGAGGAGGAACATATTTACTAGTtata 34
ath-miR156a-5p ggaggTGACAGAatgcgtgctcaccctctatctgtcaccccc 7
"file1.txt" 看起来像这样:
_1ss4TG actaaAAAACAAGTAAGCGTAATTCCTCCtagataataaaTTTACTAGTtata
osa-miR5523_L-1R+1 actaaAAAACAAGTAAGacatGAGGAGGAACATATTTACTAGTtata
ath-miR156a-5p ggaggTGACAGAatgcgtgctcaccctctatctgtcaccccc
我想在第三列中打印出现的大写字母,因此它看起来像这样:
_1ss4TG actaaAAAACAAGTAAGCGTAATTCCTCCtagataataaaTTTACTAGTtata 33
osa-miR5523_L-1R+1 actaaAAAACAAGTAAGacatGAGGAGGAACATATTTACTAGTtata 34
ath-miR156a-5p ggaggTGACAGAatgcgtgctcaccctctatctgtcaccccc 7
我已经尝试过使用 grep 和 awk,但我没弄对。
awk '{NF+=1;=length(gensub("[a-z]","","g",))}1' b
_1ss4TG actaaAAAACAAGTAAGCGTAATTCCTCCtagataataaaTTTACTAGTtata 33
osa-miR5523_L-1R+1 actaaAAAACAAGTAAGacatGAGGAGGAACATATTTACTAGTtata 34
ath-miR156a-5p ggaggTGACAGAatgcgtgctcaccctctatctgtcaccccc 7