0

My file extension is CSV file looks below format in unix server.

"Product_Package_Map_10302017.csv","451","2017-10-30 05:02:26" "Targeting_10302017.csv","13","2017-10-30 05:02:26", "Targeting_Options_10302017.csv","42","2017-10-30 05:02:27"

I want to delete a particular line based on filename keyword.

codeforester
  • 39,467
  • 16
  • 112
  • 140
Velu
  • 57
  • 2
  • 11

2 Answers2

2

You can use grep -v:

grep -v '^"Product_Package_Map_10302017.csv"' file > file.filtered
  • '^"Product_Package_Map_10302017.csv"' matches the string "Product_Package_Map_10302017.csv" exactly at the line beginning

or sed can do it in-place:

sed -i '/^"Product_Package_Map_10302017.csv"/d' file

See this related post for other alternatives:

codeforester
  • 39,467
  • 16
  • 112
  • 140
  • Is this possible to remove particular line in same file. Instead of creating new file ? – Velu Dec 19 '17 at 06:05
0

See this previous question. A grep-based answer would be my first choice but, as you can see, there are many ways to address this one!

(Would have just commented, but my 'rep' is not yet high enough)

AJD
  • 2,400
  • 2
  • 12
  • 22