- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: grep command
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
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
08-21-2002 02:47 AM
08-21-2002 02:47 AM
Is there a way exclude several patterns all at once from a file?
I have the a file of the form:
#cat fileA
FILE OWNER SIZE
--------------------
f1 ken 17
f2 john 17
f3 peter 17
I would like to ignore lines beginning with FILE and with the pattern "------", simultaneously
I tried the followiu:
#grep -v "FILE" "--" fileA > temp
grep: 0652-033 Cannot open --.
#grep -vv "FILE" "--" fileA > temp
grep: 0652-033 Cannot open --.
#grep -v "FILE" -v "--" fileA > temp
grep: 0652-033 Cannot open --.
could someone show me how I could exclude several patterns from different lines in a file, simultenously i.e in 1 command?
Thanks.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 02:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 02:50 AM
08-21-2002 02:50 AM
Re: grep command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 02:51 AM
08-21-2002 02:51 AM
Re: grep command
Instead of multiple "-e" options, you can also put the patterns in a file and use that file "-f pattern_file".
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 02:51 AM
08-21-2002 02:51 AM
Re: grep command
You need to use the following:
grep -v -e '
Cheers,
Ollie.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 02:52 AM
08-21-2002 02:52 AM
Re: grep command
[No points for this one please.]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 02:54 AM
08-21-2002 02:54 AM
Re: grep command
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 02:58 AM
08-21-2002 02:58 AM
Re: grep command
Of course the other responses, including mine :-), deserve points.
[No points for *T*H*I*S* response please! :-)]
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 03:06 AM
08-21-2002 03:06 AM
Re: grep command
Create a file containing your ignore strings, e.g.
fileA.ignore contains:
FILE
----
then:
grep -v -f fileA.ignore fileA
Rgds, Robin.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 03:23 AM
08-21-2002 03:23 AM
Re: grep command
I tried what you've suggested. But the pattern is fileA is still not ignored.
#cat pattern
FILE
------
#grep -v pattern fileA > temp
The file temp still contains patterns beginning with FILE and ---
Could you show me how I could have such patterns included into the file?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-21-2002 04:32 AM
08-21-2002 04:32 AM
Re: grep command
Pete
Pete
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-22-2002 08:49 AM
08-22-2002 08:49 AM
Re: grep command
egrep -v 'FILE|---' fileA
good luck