Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

wat grep ik uit met egrep "^ [^ ][^ ]*"

Status
Not open for further replies.

ap1605

Programmer
Mar 12, 2003
35
NL
Wie kan mij uitleggen wat er wordt bedoeld met "^ [^][^]*" in het volgende commando?

lscfg -v|egrep "^ [^][^]*"
 
Sorry i wrote my question in Dutch.
Who could explain what the meaning this is "^ [^][^]*" in the following command?

lscfg -v|egrep "^ [^][^]*"





 
The regular expression means:

- a line that begins with a space
- then two literal '^' characters
- followed by zero or more of any character.

-jim
 
Hi,
Jim is not right.
"^ " - line begins with space
"[^][^]" - line contains NOT only ], [, ^
"*" - line contains some letters

I think it is joke.

Regards Boris
 
It isn´t a joke what I want is the Serial- ,FRU-, & partnumber numbers of the resources.

My command is:

lscfg -v| tail +7| egrep "^ [^ ][^ ]*|FRU Number|Serial Number|Part Number"

Thank you for all input
 
The RE "^ [^][^]*" does match what i said before.

However, I noticed the subject of your post has this for
the RE: "^ [^ ][^ ]*"

That is:
- a line that begins with a space
- excluding lines with any other spaces (consecutively?)
- followed by zero or more of any character

Of course some sample input / output would be helpful.

-jim
 
> The RE "^ [^][^]*" does match what i said before.

Actually the first RE does not work. should have tested this first OMIF.

-jim
 
some sample input / output

lscfg -v| tail +7| egrep "^ [^ ][^ ]*|FRU Number|Serial Number|Part Number"


hdisk3 10-60-00-11,0 16 Bit LVD SCSI Disk Drive (9100 MB)
FRU Number..................34L7393
Serial Number...............F806826E
Part Number.................34L7387
hdisk4 10-60-00-12,0 16 Bit LVD SCSI Disk Drive (9100 MB)
FRU Number..................07N3778
Serial Number...............4DGRE695
Part Number.................07N3821
 

[tt]"^ [^ ][^ ]*|FRU Number|Serial Number|Part Number"[/tt]

matches any line which starts with 2 spaces followed by 1 or more non spaces or contains FRU Number or contains Serial Number or contains Part Number

It seems like you left some spaces out of your first posts. CaKiwi

"I love mankind, it's people I can't stand" - Linus Van Pelt
 
The regular expression looks to me like:
Either the line contains:
[ul]
[li]FRU Number
[li]Serial Number
[li]Part Number
[li]An anchor to the start of the line, followed by 2 spaces, followed by one non-space, followed by zero or more non-spaces. In other words - an anchor to the start of the line, followed by 2 spaces, followed by one or more non spaces (egrep does not have the equivalent of the '+' metacharacter).
[/ul]
Hope this helps, cheers, Neil
 
U zou ons moeten maken de vraag in het Nederlands beantwoorden! [bigsmile]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top