- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: grep for more than 1 value
Categories
Company
Local Language
Forums
Discussions
- Integrity Servers
- Server Clustering
- HPE NonStop Compute
- HPE Apollo Systems
- High Performance Computing
Knowledge Base
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Knowledge Base
Forums
Discussions
- Cloud Mentoring and Education
- Software - General
- HPE OneView
- HPE Ezmeral Software platform
- HPE OpsRamp Software
Knowledge Base
Discussions
Forums
Discussions
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
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-09-2008 02:41 AM
09-09-2008 02:41 AM
I need to grep for more than 1 value and neglect all those lines.
I tried as below:-
cat File_name | grep -v value1
But i can't use grep -v for neglecting more than 1 value.Is there any way to resolve this problem?
Please help me to find out the solution.
Thanks & regards
Muktha
Solved! Go to Solution.
- Tags:
- grep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2008 02:46 AM
09-09-2008 02:46 AM
Re: grep for more than 1 value
Try egrep
# egrep -e value1 -e value2 File_name
Regards,
Robert-Jan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2008 02:51 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2008 03:10 AM
09-09-2008 03:10 AM
Re: grep for more than 1 value
cat 1.txt
1
3
5
cat test.txt
1
2
3
4
5
6
7
grep -v -f 1.txt test.txt
2
4
6
7
regards,
ivan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2008 03:14 AM
09-09-2008 03:14 AM
Re: grep for more than 1 value
Thanks for your quick respose.
Regards
Muktha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2008 03:15 AM
09-09-2008 03:15 AM
Re: grep for more than 1 value
It worked out.
Regards
Muktha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2008 03:16 AM
09-09-2008 03:16 AM
Re: grep for more than 1 value
You gave new idea..
Regards
Muktha
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2008 03:47 AM
09-09-2008 03:47 AM
Re: grep for more than 1 value
First, don;t add a useless 'cat' to open and read the file, piping that output to 'grep'. That's a wasted process and wasted I/O.
You can do :
# grep -v -e value1 -e value2 -e value3 File_name
(or):
# grep -vE "value1|value2|value3" File_name
Regards!
...JRF...
- Tags:
- evil cat
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2008 04:31 AM
09-09-2008 04:31 AM
Re: grep for more than 1 value
Anyway thanks for the guidance.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2008 04:36 AM
09-09-2008 04:36 AM
Re: grep for more than 1 value
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-10-2008 12:20 PM
09-10-2008 12:20 PM
Re: grep for more than 1 value
grep -v 'value1
value2
value3' File_name