ファイルから特定の行を削除する

ファイルから特定の行を削除する

私のCSVファイルの途中に次の行があります。

Products below this line are out of stockNumber, month, year, reference, store

注:数値、月、年、参照番号、および店舗はCSVフィールドです。

コマンドラインコマンドを使用してファイルからこの行を削除するにはどうすればよいですか?

CSVは次のとおりです。

Number, month, year, reference, store
1,1,2014,13322,main
2,2,2014,13322,main
3,3,2011,1322,main
4,4,2012,3322,main
5,4,2013,122,secondary
Products below this line are out of stockNumber, month, year, reference, store
12,411,2010,122,Albany
25,41,2009,122,Dallas
35,24,2008,122,New

ベストアンサー1

最も簡単な方法は、grep -v次のコマンドを使用することです。

grep -v "Products below" your_file.csv > new_file.csv

おすすめ記事