【发布时间】:2018-05-24 01:18:53
【问题描述】:
我正在尝试对文本文件中的字符串使用tr 命令,以便可以将其替换为换行符。例如,我的文件中有这样一行
biological_process GO:0000001 mitochondrion inheritance is_a GO:0048308 organelle inheritance
现在我想把它转换成这样的
biological_process GO:0000001 mitochondrion inheritance
GO:0048308 organelle inheritance
我之前使用过tr 命令,我认为它会起作用,但现在当我尝试像这样运行它时它会起作用
test="biological_process GO:0000001 mitochondrion inheritance is_a GO:0048308 organelle inheritance"
echo $test | tr 'is_a' '\n'
b
olog
c
l
proce
GO:0000001 m
tochondr
on
nher
t
nce
GO:0048308 org
nelle
nher
t
nce
【问题讨论】:
-
Stack Overflow 是一个编程和开发问题的网站。这个问题似乎离题了,因为它与编程或开发无关。请参阅帮助中心的What topics can I ask about here。也许Super User 或Unix & Linux Stack Exchange 会是一个更好的提问地点。