4
votes
2answers
259 views

regex search works with `grep -E` but not with bash script?

I use the same regex with grep and it gives me a match but when doing it in a bash script, it return no match. Test String(part of the file testregex.txt): <a ...
2
votes
1answer
294 views

Using Modifiers of Perl-compatible Regex (PCRE) in grep

According to grep --help and man grep, we can use the -P option in order to interpret the pattern as a Perl regular expression (PCRE, to be precise), instead of the default POSIX basic regular ...
2
votes
2answers
278 views

grep stirght from a pcap file (no tcpdump)

I'm trying to figure out the correct command syntax. I have a pcap file, and I want to use grep, and grep only to take out all of the uniq ip addresses from without the file So assuming the file is ...
0
votes
1answer
140 views

how can i use grep to find IPV4 Number in a pcap file with regx syntac?

I'm new in ubuntu. I have this IP regex '\b((25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)(\.|$)){4}\b' I have a network pcap file, I want to use this regex and the grep -e to find all IP address in the ...
3
votes
1answer
88 views

Did grep change how it uses regexp?

I used to run commands like: find /dev | grep sd* to output a list of all the drives attached to my computer. It appears that I now have to add any random character before the star in order to get the ...
1
vote
1answer
363 views

Grep Regex match not returning result as expected

I have several Ubuntu servers and there is some behavior that has me curious. On any newly installed machine (Ubuntu Server 12.04.3 LTS), if I run: echo "testbla123" | grep -P -o [0-9]* This will ...
1
vote
0answers
116 views

Grep word in one file, and use that word to match in another file, adding the thing that follows the match

I want to grep several words in file1, and use each word to grep what follows after its match in file2. And then I want to add the thing that followed the match to the word I used into file03, so that ...
4
votes
1answer
114 views

Custom GREP with asterisks and anchors?

I have lots of EDI files (which is pretty much a single line of gibberish text) that are about 300mb/pcs. I'm looking to pattern matching this: `*UP*605284466346 {lots of other stuff inbetween with ...
1
vote
1answer
7k views

How to find a folder on my server with a certain name?

I have a directory somewhere on my server wth the name "exampledocs". I tried to find it's location using: ls -d */ | grep -E 'exampledocs' and find * -regextype posix-extended \-regex ...
2
votes
3answers
1k views

grep for string not preceded by another string

Is it possible, using grep, to search for instances of John Smith but exclude instances of Mr John Smith?
1
vote
1answer
1k views

How to make grep display only the matching regexp?

I am trying to find data from files using grep, but grep usually prints out the filename as well as the line where the term is found. In this case, I am looking for a special regexp and I want grep ...