从命令中获取多行并在一行中水平打印

时间:2014-10-13 12:25:30

标签: awk

我运行一个显示以下结果的命令

Model = FordMustang  
Drivetype = Rear Wheel Drive  
Horsepower = 300 hp @ 6500 rpm (3.7L V6)   
Transmission = 6-Speed SelectShift® Automatic with Paddle Shifters, optional   
Wheel1type = Alloy   
Wheel2type = Magwheel   
Wheel3type = Steel   
Warranty1 = Bumper to Bumper: 3 years / 36,000 miles   
Warranty2 = Safety Restraint System: 5 years / 60,000 miles   
Price1 = Dealer 52000   
Price2 = ExShowroon 54000  

我想格式化输出并将数据打印成行

**Model     DriveType         Horsepower       Wheel       Price**  

我可以使用awk来做这件事吗?

1 个答案:

答案 0 :(得分:0)

试试这个:

awk -F'=' '{printf "%s", $1}' test.txt