我試圖將兩行csv文件組合成一行。將兩個csv行組合成一行
CSV文件:
"Operations=5009.0,AverageLatency(us)=714.4248352964663,MinLatency(us)=300.0,MaxLatency(us)=173567.0,95thPercentileLatency(us)=1216.0,99thPercentileLatency(us)=2645.0,Return=5009"
"Operations=4991.0,AverageLatency(us)=831.4189541174113,MinLatency(us)=370.0,MaxLatency(us)=25999.0,95thPercentileLatency(us)=1495.0,99thPercentileLatency(us)=2857.0,Return=4991"
預期輸出:
"Operations=5009.0,AverageLatency(us)=714.4248352964663,MinLatency(us)=300.0,MaxLatency(us)=173567.0,95thPercentileLatency(us)=1216.0,99thPercentileLatency(us)=2645.0,Return=5009","Operations=4991.0,AverageLatency(us)=831.4189541174113,MinLatency(us)=370.0,MaxLatency(us)=25999.0,95thPercentileLatency(us)=1495.0,99thPercentileLatency(us)=2857.0,Return=4991"
我嘗試這樣做:
awk 'NR%2{printf $0" ";next;}1' file.csv
但它不打印整個第一行。
"Operations=5009.0,AverageLatency(us)=714.4248352964663,MinLatency(us)=300.0,MaxLatency(us)=173567.0,95thPercentileLatency(us)=1216.0,99thPercenti "Operations=4991.0,AverageLatency(us)=831.4189541174113,MinLatency(us)=370.0,MaxLatency(us)=25999.0,95thPercentileLatency(us)=1495.0,99thPercentileLatency(us)=2857.0,Return=4991"
任何想法?
感謝
你使用什麼編程語言? – Whitecat
@Whitecat我正在使用python。 – arazx