How to merge every two lines into one from the command line?

后端 未结 21 2041
没有蜡笔的小新
没有蜡笔的小新 2020-11-22 15:14

I have a text file with the following format. The first line is the \"KEY\" and the second line is the \"VALUE\".

KEY 4048:1736 string
3
KEY 0:1772 string
1         


        
21条回答
  •  感情败类
    2020-11-22 15:39

    Try the following line:

    while read line1; do read line2; echo "$line1 $line2"; done new_file
    

    Put delimiter in-between

    "$line1 $line2";
    

    e.g. if the delimiter is |, then:

    "$line1|$line2";
    

提交回复
热议问题