- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- grep "abc" but exclude "def" and "ghi" in the file
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
Discussions
Discussions
Discussions
Forums
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
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
тАО11-18-2003 09:33 AM
тАО11-18-2003 09:33 AM
grep "abc" but exclude "def" and "ghi" in the file
Can I do that?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2003 09:49 AM
тАО11-18-2003 09:49 AM
Re: grep "abc" but exclude "def" and "ghi" in the file
grep -e 'abc' < infile | grep -v -e 'def' -e 'ghi' > outfile
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2003 05:09 PM
тАО11-18-2003 05:09 PM
Re: grep "abc" but exclude "def" and "ghi" in the file
Use the command
grep "abc" -v "def" "ghi" <
Thanx
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-18-2003 05:48 PM
тАО11-18-2003 05:48 PM
Re: grep "abc" but exclude "def" and "ghi" in the file
awk '/def/ {next} /ghi/ {next} /abc/'
should do the trick.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2003 03:21 AM
тАО11-19-2003 03:21 AM
Re: grep "abc" but exclude "def" and "ghi" in the file
Clays├В┬┤s and Elmar├В┬┤s work.
Suresh: it doesnt work that way. You cant include and exclude with multiple patterns at the same time.
greetings,
Mich
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2003 03:39 AM
тАО11-19-2003 03:39 AM
Re: grep "abc" but exclude "def" and "ghi" in the file
What is '{next}' in awk, can you please explain it to me?
Thanks,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-19-2003 03:56 AM
тАО11-19-2003 03:56 AM
Re: grep "abc" but exclude "def" and "ghi" in the file
next tells awk to discard this line and start the loop with the next line.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО11-26-2003 02:57 AM
тАО11-26-2003 02:57 AM
Re: grep "abc" but exclude "def" and "ghi" in the file
if the problem is solved, could you spare some points from the endless supply of points, HP has, for those, who could help you? ;-)
greetings,
Michael