1、现有测试数据如下:

cat a.txt
hadoop1
1
hadoop2
2
hadoop3
3

2、期望的格式

hadoop1: 1
hadoop2: 2
hadoop3: 3 

3、使用awk

awk '{if(NR%2!=0)ORS=":";else ORS="\n"}1' a.txt

| http://bbs.chinaunix.net/thread-4241658-1-1.html

相关文章:

  • 2021-06-15
  • 2021-08-02
  • 2022-01-01
  • 2021-12-17
  • 2021-12-17
猜你喜欢
  • 2021-08-03
  • 2021-12-17
  • 2021-11-12
  • 2022-12-23
  • 2022-12-23
  • 2021-12-17
相关资源
相似解决方案