sed 匹配某一行的上一行,然后删除这行最后的换行符。 10

原始文件"1","211.211.222.0","学习(51/1)","21128","2016","60"^M"2","211.111.122.0","学习(9/4)"... 原始文件
"1","211.211.222.0","学习 (51/1)","21128","2016","60"^M
"2","211.111.122.0","学习 (9/4)","22138","2016","60"^M
"4","111.211.333.0","学习 (1/2)
","21515","2016/5/12 0:00:09","60"^M
"8","219.235.141.0","学习 (46/64)","21612","2016","60"^M
"5","211.211.222.0","听课","3202","20169","60"^M
"9","211.211.222.0","听课","4198","2016","60"^M
"7","211.211.222.0","听课","2395","2016","60"^M
"12","111.211.123.0","学习 (9/2)
","111","2016","60"^M
识别","这行的上一行,删除换行符。两行合并
要改成这样
"1","211.211.222.0","学习 (51/1)","21128","2016","60"^M
"2","211.111.122.0","学习 (9/4)","22138","2016","60"^M
"4","111.211.333.0","学习 (1/2)","21515","2016","60"^M
"8","219.235.141.0","学习 (46/64)","21612","2016","60"^M
"5","211.211.222.0","听课","3202","2016","60"^M
"9","211.211.222.0","听课","4198","2016","60"^M
"7","211.211.222.0","听课","2395","2016","60"^M
"12","111.211.123.0","学习 (9/2)","111","2016","60"^M
展开
 我来答
albumin
2016-05-16 · TA获得超过1.2万个赞
知道大有可为答主
回答量:4889
采纳率:87%
帮助的人:2399万
展开全部
sed '{
N
s/\(.*\)\n\(",".*\)/\1\2/
t merge
P
D}
:merge 
p
d' 原始文件名 > 修改后的文件名
良玉小帝
2016-05-15 · 个人日常精心汇总合集
良玉小帝
采纳数:5925 获赞数:9451

向TA提问 私信TA
追问
这个。用我这个例子写不了啊。 ","这行的上一行没有一样的词。
已赞过 已踩过<
你对这个回答的评价是?
评论 收起
推荐律师服务: 若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询

为你推荐:

下载百度知道APP,抢鲜体验
使用百度知道APP,立即抢鲜体验。你的手机镜头里或许有别人想知道的答案。
扫描二维码下载
×

类别

我们会通过消息、邮箱等方式尽快将举报结果通知您。

说明

0/200

提交
取消

辅 助

模 式