【发布时间】:2015-05-30 22:38:22
【问题描述】:
我正在尝试用换行符替换每行中出现的 first 个空格。
例如
123 there is a monkey
567 there is also a tiger
会变成
123
there is a monkey
567
there is also a tiger
我已尝试使用以下命令:
sed -e 's/^\s\+/\n/g' output.txt > new.txt
没有运气。我也对 linux 中允许我执行此操作的任何其他程序持开放态度,例如 awk、perl 或 bash。
【问题讨论】: