0

I have text files in which some lines includes emojis or other non Ascii characters, like the list in this screenshot:

enter image description here

I need a way to remove the whole lines containing an emoji or more. Even the lines containing non Ascii characters would be removed but I am for the emojis in this approach.

I have seen and tried the answers on questions like this:

  1. https://stackoverflow.com/questions/58421709/how-do-i-find-and-remove-emojis-in-a-text-file
  2. https://stackoverflow.com/questions/52266347/grep-for-emojis-in-linux
  3. https://stackoverflow.com/questions/58421709/how-do-i-find-and-remove-emojis-in-a-text-file
  4. https://stackoverflow.com/questions/2899423/filtering-out-emoticons-using-sed
  5. https://stackoverflow.com/questions/52266347/grep-for-emojis-in-linux

But they provide answers on how to remove the emojis, not the whole line containing emojis

Any help to grep, sed, awk or other bash based command is appreciated but a direction on how to do this with php, python, perl or anything else may also work.

Geppettvs D'Constanzo
  • 19,364
  • 7
  • 51
  • 106
  • See if [this](https://askubuntu.com/questions/730591/ascii-source-file-checker) helps. You want the opposite as to what I wanted, so maybe `grep -Pv '[^\x00-\x7F]'`. – Doug Smythies Apr 29 '22 at 18:20
  • 1
    If you've got a regular expression that works in a sed `s/regex/replacement/` command, then you can use that same regex in a sed `/regex/d` command – steeldriver Apr 29 '22 at 18:27

0 Answers0