Questions tagged [egrep]

22 questions
4
votes
4 answers

What are the advantages, if any of grep over egrep

I'm just learning about the grep family of programs, and it seems to me that egrep is strictly superior to grep - it can do everything that grep can do, but more. Am I wrong? Why not just use egrep every time? EDIT: I know that grep -E is the same…
MYV
  • 1,243
3
votes
1 answer

When piped with ls, grep in solaris is not working

I am using the below command in solaris ls -l | grep '*PROC*' But it is not working. I have many files that contain "PROC" in their name like "XREF_PROC.complete" but when I use the above command its not showing any output. When I use ls *PROC* its…
1
vote
1 answer

Need to match running processes in egrep

I need to find all running processes whose owner is neither root nor Student. I know how to not get running processes whose owner is neither root nor Student by type ps aux | egrep '^[^(root)|(Student)]' I am struggling with get all running…
Rikki
  • 11
  • 2
1
vote
0 answers

Unable to match start-of-line using egrep

I've the following command that works good on my macOS; git branch | egrep -v --regex "$REGEX_PATTERN" | xargs git branch -D where the REGEX_PATTERN=(develop|master|release|). When I change my regex into REGEX_PATTERN=^(develop|master|release|) to…
stdout
  • 111
1
vote
2 answers

Remove specific string from file

output.txt 1.1.1.1:22/ does not support password authentication. [ERROR] target ssh://2.2.2.2:22/ does not support password authentication. [ERROR] target ssh://3.3.3.3 i want to remove string :22/ does not support password authentication. [ERROR]…
1
vote
1 answer

find -exec grep {} \; egrep -v string \; # the command chain brakes

I'm playing with find command to see how it behaves and I'm a bit lost. First bit is fine : find . -maxdepth 1 -exec grep -l abc {} \; grep: .: Is a directory ./file2.pdf ./file1 Then I try to exclude the .pdf file by chaining another egrep…
Tomas.R
  • 195
0
votes
0 answers

how to grep exact pattern

I’ve tried several grep / egrep ideas with different options but none worked here. I’m trying to grep exact match of the pattern I’m looking in a log. For example I want only a pattern “ERROR” to get grepped, rather than a word “ERROR123.” I have…
0
votes
3 answers

egrep for time in H:MM:SS format

Working on the file an need to grep the line with a time stamp in the H:MM:SS format. I tried the following egrep '[0-9]:[0-9]:[0-9]'. Didn't work for me. What am i doing wrong in regex?
Serg12
  • 101
  • 1
0
votes
1 answer

Restrict grepping to non-comment lines

I need to find in Perl source files lines containing bin/exim|SendEmail|Unformatted except of comment lines (lines starting with # with possible whitespace before). I know how to do it with a pipeline of several invocations of FreeBSD grep command.…
porton
  • 323
0
votes
1 answer

grep next exact match in double quotes

I am trying to grep string and next string which is marked in double quotes. Its a .xml file and the content would be as below:
0
votes
1 answer

How do I use Ubuntu 'regextype egrep -regex' negative lookbehind

Assume I have the following two files: fileA.pdf pp_1234_fileB.pdf If I am to run the following in PowerShell, the file, fileA.pdf is returned. get-childitem -file -recurse | where-object {$_.Name -match "^(?!pp_[0-9]{4}_).*\.pdf"} but if I try to…
Brian
  • 1,085
0
votes
1 answer

How can I combine "Search for multiple strings (patterns)" with "Print rows after a hit" in a string/search and output a common file?

I am using the windows version of grep "GNU Grep". syntax: grep [OPTIONS] PATTERN [FILE...] How can I combine different options with different patterns? Both lines listed here work on their own. But I have not yet succeeded in combining them. grep…
minu
  • 3
0
votes
0 answers

when running "LC_ALL=C.UTF-8 egrep -axv '.*'" to detect non-UTF8 characters how can I determine the exact character that caused the detection?

I frequently use this command: LC_ALL=C.UTF-8 egrep -laxv '.*' filename this tells me if the file contains any non-UTF8 characters (actually I usually use this in conjunction with find to scan many files at once) I can remove the -l to get the…
0
votes
1 answer

'grep' command not highlighting User input word in the Search result

I am trying to write shell script as below to search user inputted word and highlight the word in the search result - # User input: echo -n -e "What you wanna search:" read userinput # Save the search result in a file egrep "$input"…
0
votes
3 answers

egrep to find in a file with numbers and words those numbers not starting with 91 or 93

I have a file with numbers and words and I need to get only…
1
2