如何输出 csv 文件的第一个副本?例如,如果我有:
00:0D:67:24:D7:25,1,-34,123,135
00:0D:67:24:D7:25,1,-84,567,654
00:0D:67:24:D7:26,1,-83,456,234
00:0D:67:24:D7:26,1,-86,123,124
00:0D:67:24:D7:2C,1,-56,245,134
00:0D:67:24:D7:2C,1,-83,442,123
00:18:E7:EB:BC:A9,5,-70,123,136
00:18:E7:EB:BC:A9,5,-90,986,545
00:22:A4:25:A8:F9,6,-81,124,234
00:22:A4:25:A8:F9,6,-90,456,654
64:0F:28:D9:6E:F9,1,-67,789,766
64:0F:28:D9:6E:F9,1,-85,765,123
74:9D:DC:CB:73:89,10,-70,253,777
我希望我的输出看起来像这样:
00:0D:67:24:D7:25,1,-34,123,135
00:0D:67:24:D7:26,1,-83,456,234
00:0D:67:24:D7:2C,1,-56,245,134
00:18:E7:EB:BC:A9,5,-70,123,136
00:22:A4:25:A8:F9,6,-81,124,234
64:0F:28:D9:6E:F9,1,-67,789,766
74:9D:DC:CB:73:89,10,-70,253,777
我在考虑首先输出 csv 文件的第一行,awk (code that outputs first row) >> file.csv
然后将行的第一个字段与下一行的第一个字段进行比较,如果它们相同,请检查下一行。直到出现新行,代码将再次输出新的不同行,awk (code that outputs) >> file.csv
并且将重复直到检查完成
我对 bash 编码有点陌生,但到目前为止我很喜欢它,我目前正在编写一个 csv 文件,我需要一些帮助。感谢大家