shell脚本删除数字串后的新行 [英] Shell script to remove new line after numeric string
本文介绍了shell脚本删除数字串后的新行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我需要写一个shell脚本数字字符串后才后删除新的生产线?或字符串后,不以数字开头。例如,一个有一个文件:
I need to write a SHELL Script to remove new line after only after a numeric string? or after string doesn't start with number. For example a have a file:
asasas
12345
adab-123
123
我需要像这样的输出:
I need output like this:
asasas 12345
adab-123 123
sed的':一个; N; $ BA; S / \\ n / / g的
只是把它拆分为:
asasas12345
adab-123123
和 sed的':一个; N; $ BA; S / \\ n / / g的!
给我:
asasas 12345 adab-123 123
请帮忙。
谢谢你。
Please help. Thanks.
推荐答案
在这里你去!
[jaypal~]$ cat file9
asasas
12345
adab-123
123
[jaypal~]$ sed '{N;s/\n/ /g}' file9
asasas 12345
adab-123 123
[jaypal~]$
这篇关于shell脚本删除数字串后的新行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文