Need help with egrep command

Id10t

New Member
Joined
Nov 4, 2018
Messages
7
Reaction score
2
Credits
0
Can anyone help me write an egrep command that will output all lines that contain 2 or more semi-colons. It seems simple but I've been stuck on this one for awhile now. Thanks
 


G'day @Id10t and welcome to linux.org :)

I have moved this Thread to Command Line where it may attract more knowledgeable help.

It's beyond my paygrade but I will watch and learn ;)

Enjoy your Linux

Chris Turner
wizardfromoz
 
G'day @Id10t and welcome to linux.org :)

I have moved this Thread to Command Line where it may attract more knowledgeable help.

It's beyond my paygrade but I will watch and learn ;)

Enjoy your Linux

Chris Turner
wizardfromoz
Thank you
 
Can anyone help me write an egrep command that will output all lines that contain 2 or more semi-colons together or separate. It seems simple but I've been stuck on this one for a while now. Thanks

Update: I figured it out egrep '([^;]*;){2}' file

F.Y.I. Smiley wink is semicolon right parenthesis, I couldn't figure out how to keep the post from automatically posting the emoji equivalent.
 
Last edited:
Code:
grep -E '(;+)'

Easier? Moreover I think your command matches all ERE that don't start with a ; and contain 2 ;
 
Last edited:
  • Like
Reactions: Rob
In your Reply Pane toolbar/menu near right is a plus sign (+) in a square, click that, it has Quote, Spoiler, Code and Strike-through.

Code presents similar to the example posted by friend Capta above, so if I read your Post correctly, something like

Code:
egrep '([^;]*;){2}' file

... in fact copying and pasting your string reverts the emoji back. :)

Cheers

Wizard
 
Code:
grep -E '(;+)'

Easier? Moreover I think your command matches all ERE that don't start with a ; and contain 2 ;
Thanks for the reply CptCharis but when i used your command it also highlighted lines with only 1 ;
 

Members online


Latest posts

Top