将每隔一行与下一行连接起来 [英] Concatenating every other line with the next

查看:48
本文介绍了将每隔一行与下一行连接起来的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在文本文档中,我想将每隔一行与下一行连接起来.我想 sed 是要使用的东西吗?这将如何完成?

In a text document I want to concatenate every other line with the next. I guess sed is the thing to use? How would this be done?

推荐答案

这是最简单的使用 <代码>粘贴:

This is easiest using paste:

paste -s -d' \n' input.txt 

虽然有一个著名的 Sed One-Liner (38) 模仿 potong 的答案.

Although there's a Famous Sed One-Liner (38) to emulate this as in potong's answer.

这篇关于将每隔一行与下一行连接起来的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆