【发布时间】:2018-11-15 08:57:13
【问题描述】:
我想从文本文件中逐行读取下面的文件,并在 shell 脚本中打印我想要的方式
Text file content:
zero#123456
one#123
two#12345678
我想把它打印成:
zero@1-6
one@1-3
two@1-8
我尝试了以下方法:
file="readFile.txt"
while IFS= read -r line
do echo "$line"
done <printf '%s\n' "$file"
【问题讨论】:
-
如果你有
three#123789?结果应该是three@1-9还是类似three@1-3,7-9的东西?
标签: shell