- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- regular expression
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 08:50 AM
04-30-2002 08:50 AM
My expression can two forms:
vgcreate -p yara -e yara
or
vgcreate -g yara -p yara -e yara
What kind of regular expression I can use to identify that -g option was used?
I tried "grep vgcreate*.*-g*.*" didn't work!
Thanks a lot!
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 09:04 AM
04-30-2002 09:04 AM
Re: regular expression
vgcreate -g yara -p yara -e yara
grep -- "-g " file
The two -- are so grep knows that -g is not on option for it to use.
In your sample you didn't have double quotes around the expression and the shell will attempt to expand them to filenames.
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 09:06 AM
04-30-2002 09:06 AM
Re: regular expression
I tried you way, didn't work.
grep -- vgcreate*.*"-g"*.* filename
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 09:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 09:21 AM
04-30-2002 09:21 AM
Re: regular expression
ie again
grep "\-g" file
Manoj Srivastava
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 09:21 AM
04-30-2002 09:21 AM
Re: regular expression
# grep -e 'vgcreate* '\-g' *' filename
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 09:22 AM
04-30-2002 09:22 AM
Re: regular expression
#t=1234567890
#echo $t |cut -c 6 will return 6.
In your case it is 11
Sachin
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-30-2002 10:27 AM
04-30-2002 10:27 AM
Re: regular expression
> vgcreate -p yara -e yara
> or
> vgcreate -g yara -p yara -e yara
> What kind of regular expression I can use to > identify that -g option was used?
> I tried "grep vgcreate*.*-g*.*" didn't work!
> Thanks a lot!
grep 'vgcreate.*-g'
The '*' after the 'e' in vgcreate is a common
confusion between regular expressions and glob
patterns (such as what the shell uses to match
files). Those quotes are single quotes, not backticks; that is IMPORTANT. Double quotes would also work here. The '*' after the 'g'
actually BREAKS the search, since it indicates
that the 0 or more more 'g's can match. It is not necessary to match the entire line to get
grep to match, so the attempt to match
"everything else" after the '-g' is unnecessary.