1
grep -Px -e '"[^|,"\v]*"(,"[^|,"\v]*")+\v' FILENAME.csv > FILENAME.csv

previously worked in GNU Grep, now because -P isn't in BSD Grep it no longer works.

which command could I use to get the same result?

Lalit Verma
  • 782
  • 10
  • 25
CPuleo
  • 11
  • 3
  • 1
    Isn't `-E` good enough for this regex? – zdim Dec 07 '17 at 17:48
  • as oppose to using -Px altogether? – CPuleo Dec 07 '17 at 17:49
  • 1
    Please bear in mind that reading a file and at the same time redirecting to it (as in `grep ... FILE > FILE`) gives unpredictable results. It may or may not work. It often depends on the size of the file whether it is completely read before it gets (over)written. To be safe, redirect to another (temporary) file and move it afterwards (`grep ... FILE > FILE.new` and -- if the results are OK -- `mv FILE.new FILE`). – PerlDuck Dec 07 '17 at 20:20
  • @ConnorPuleo No, just `-E` instead of `-P`, i.e. `grep -E -x -e '…'`. But I didn't try it. – PerlDuck Dec 07 '17 at 20:31

0 Answers0