- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Regular Expression Question
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
09-06-2002 07:45 AM
09-06-2002 07:45 AM
Please help me in composing very simple regular expression.
I'm parsing e-mail box and there is a need to distinguish two "From" lines
From root@host.com Fri Sep 6 18:32:25 2002
and
From: root@host.com
Both lines are retrieved by expression /From/
I'd like to get line with word 'From' followed by white space. The white space is my problem.
Thanks and points in advance!
BR,
Mihails
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 07:47 AM
09-06-2002 07:47 AM
Re: Regular Expression Question
/^From:?\s*(.*)/
Then $1 would contain text
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 07:50 AM
09-06-2002 07:50 AM
Re: Regular Expression Question
or
Cat mail.box | grep From | grep -v "From:"
I think this is what you wanted?
c
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 07:52 AM
09-06-2002 07:52 AM
Re: Regular Expression Question
grep "From " file
doesn't work?
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 07:54 AM
09-06-2002 07:54 AM
Re: Regular Expression Question
grep
will get the word "From" followed by a whitespace.
grep "From:" will grabe other
if the whitespace is a tab, then
grep "From\ "
where the whitespace above is a tab.
This should not require really a regular expression to get, but the same principles exist.
regards,
Shannon
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 07:55 AM
09-06-2002 07:55 AM
Re: Regular Expression Question
Try /From / (there is a space right behind From.)
Hai
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 07:57 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 07:58 AM
09-06-2002 07:58 AM
Re: Regular Expression Question
Try:
awk '/From[ ]/ {print}'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 08:15 AM
09-06-2002 08:15 AM
Re: Regular Expression Question
/From[
Where
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-06-2002 08:23 AM
09-06-2002 08:23 AM
Re: Regular Expression Question
/From[:space:]/
See man 5 regexp
Regards,
John
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2002 03:03 AM
09-10-2002 03:03 AM
Re: Regular Expression Question
BR,
Mihails