Questions tagged [grep] (58)

1
answer

Regex string in the grep argument?

As a regex string to turn into an argument of grep? ^(?!127)[0-9]{0,3}\.[0-9]{0,3}\.[0-9]{0,3}\.(?!255)[0-9]{0,9} grep the toybox usage: grep [-EFrivwcloqsHbhn] [-ABC NUM] [-m MAX] [-e REGEX]... [-MS PATTERN]... [-f REGFILE] [FILE]... Show lines matching regular expressions. If no -e, first argument is regular expression ...
Brenda_Dare asked April 18th 20 at 12:44
2
answers

As from /var/log/pacman.log to the package names?

Need help with bash to get the list of packages from /var/log/pacman.log File structure like this: [2020-04-02T15:20:39+0500] [ALPM] installed dhclient (4.4.2-2) [2020-04-02T15:20:39+0500] [ALPM] installed perl-yaml-syck (1.32-1) How is it possible to do so, to eventually get: dhclient perl-yaml-syck
Jaclyn_Dani asked April 16th 20 at 10:51
1
answer

How to Prepnut?

1) If I want to read all files in the current directory and find a file with some word, usecat * | grep -n "pattern" the flag -H should provide a file, but then, of course, does not issue, because there is a redirect I / o, in the end, the team wrote to me that a match is found in (standard input) In grep, you can transfer ...
emilia_Strac asked April 3rd 20 at 17:25
1
answer

Why grep regex doesn't work without shielding?

here it is:grep "[0-9]+" /file.txt Doesn't work (finds nothing). If you escape the +, i.e.:grep "[0-9]\+" /file.txt It works. Similarly with the braces. What's the matter? In the Internet all examples without a shield.
tito_Cartwright74 asked March 29th 20 at 19:44
2
answers

How to remove a template from all files?

Good afternoon. There are about 1000 almost identical html files. I need to remove from each a certain piece of text and tags. I carved it by hand from one file and saved as remove.txt. How do I use this file as a template and cut it from the rest of the files? Important point: a piece that should be cut, does not begin on ...
Jayden asked March 24th 20 at 13:46
3
answers

How to parse the file?

Good day! There's a text file with the log bind, you need to clean it from debris Looks like this: 16-May-2019 12:24:46.733 192.168.60.223#49429 top-fwz1.mail.ru I would like to bring in the following form: 16-May-2019 12:24 192.168.60.223 top-fwz1.mail.ru Help with writing a regular expression...
karolann.Brekke asked March 21st 20 at 12:01
1
answer

How to delete the contents between the text?

I want to remove all scripts in html files can't find the correct version of the lines itself a regular expression <script[\w\W]*?</script> here is how it looks on the line my reasons:find . -type f -name "*.html" -exec sed -i 's/<script[\w\W]*?</script>//g' {} \; I also tried it on every screening up to:\...
Greta_Ro asked March 19th 20 at 09:30
1
answer

How to cut a substring from a string with sed | awk?

Asking for help from connoisseurs of regular expressions. Four hours of Google left me in the same place where it was before. There is a long string retrieved from curl, I need this part: ...,"load":{"map":["load_id","add_time","marks","available","external"],"data":[["77458","1552767081","11.57","298","0"],... want to crea...
Nikita52 asked March 18th 20 at 21:36
1
answer

Looks like a regular expression for the "email:password"?

There is a ready option,([a-z0-9,!#\$%&\*\+/=\?\^_`\{\|}~-]+(\.[a-z0-9,!#\$%&\*\+/=\?\^_`\{\|}~-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*\.([a-z]{2,})[ ]?:.*) however, if you use it with grep does not output anything An example filetest@test.ru:123 test@test.ru:1234
Loy asked March 17th 20 at 12:22
2
answers

How to share words with"; "character?

echo ${string[@]} | grep -E -o-z "\b[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,6}\b" This line searches the text of the e-mail addresses and displays them. Please tell me how to display a symbol ";" after each output of the mail (except the last one are mandatory)?
elena asked March 17th 20 at 11:59