【发布时间】:2014-04-01 12:00:41
【问题描述】:
当我输入ls 时,我得到:
aedes_aegypti_upstream_dremeready_all_simpleMasked_random.fasta
anopheles_albimanus_upstream_dremeready_all_simpleMasked_random.fasta
anopheles_arabiensis_upstream_dremeready_all_simpleMasked_random.fasta
anopheles_stephensi_upstream_dremeready_all_simpleMasked_random.fasta
culex_quinquefasciatus_upstream_dremeready_all_simpleMasked_random.fasta
我想通过管道将其转换为 cut (或通过其他方式),以便我只得到:
aedes_aegypti
anopheles_albimanus
anopheles_arabiensis
anopheles_stephensi
culex_quinquefasciatus
如果 cut 接受一个字符串(多个字符)作为分隔符,那么我可以使用:
cut -d "_upstream_" -f1
但这是不允许的,因为 cut 只使用单个字符作为分隔符。
【问题讨论】:
标签: bash shell parsing text cut