I have a dump .sql for 17 GB ~ 70 files of different text content, you need to pull out the entire line containing 1 out of 200 e-mail addresses

for example:

1@mail.ru 2@yandex.ru 3@rambler.ru 4@gmail.com 

I do grep -wi -e (w for exact search by word) '1@mail.ru' * (* to search through all files in the folder, analogue of the -r key) Finds

And I do this:

 grep -wi -e '1@mail.ru|2@yandex.ru|3@rambler.ru|4@gmail.com' * 

Finds none

what am I doing wrong?

  • maybe that's it? grep -wi -e '1@mail.ru && 2@yandex.ru && 3@rambler.ru && 4@gmail.com' * or put \n instead of && . so here's another try || - Drakonoved
  • man grep - you can still try - Drakonoved
  • maybe that's it? grep -wi -e '1@mail.ru && 2@yandex.ru && 3@rambler.ru && 4@gmail.com '* or replace && to put - so nothing was found - user2061175
  • then, instead of the -e key, you can put the -F or -E key (this is from the Grepovsky manual) - Drakonoved

1 answer 1

 grep -wi '1@mail.ru\|2@yandex.ru\|3@rambler.ru\|4@gmail.com' * 
  • Is it possible to reduce the number of left? with grep -wi '1@mail.ru \ | 2@yandex.ru \ | 3@rambler.ru \ | 4@gmail.com' * are both 1@mail.ru and 111111@mail.ru - user2061175
  • one
    @ user2061175 hmm ... in theory, -w and should have solved this. But if not, try this: \b1@mail.ru\b instead of 1@mail.ru - de_frag
  • same as with -w, can it be something like -x? - user2061175
  • @ user2061175 is possible in some cases, but now it looks like методы научного тыка . Let's take a couple of lines of the real file (emails can be replaced) that appear in the search by the pattern 1@mail.ru, i.e. one line corresponding to the pattern, and the second, which is "extra". - de_frag 5:26 pm