- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: How to grep using "*"
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
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
тАО08-23-2005 07:51 AM
тАО08-23-2005 07:51 AM
/cdrom
/usr/local/bin
/oracle/ABC/sapdata
/oracle/DEF/sapdata
/oracle/ABC/archlog
I want to grep out /oracle/*/sapdata and am using the following command which is not working:
# grep -v /oracle/*/sapdata filelist
I get the following output:
/cdrom
/usr/local/bin
/oracle/ABC/sapdata
/oracle/DEF/sapdata
/oracle/ABC/archlog
I am expecting /oracle/ABC/sapdata and /oracle/DEF/sapdata to be excluded.
Please help, thanks.
Solved! Go to Solution.
- Tags:
- grep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 07:58 AM
тАО08-23-2005 07:58 AM
Re: How to grep using "*"
Could you do:
grep -v sapdata filelist
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 08:07 AM
- Tags:
- regex
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 08:09 AM
тАО08-23-2005 08:09 AM
Re: How to grep using "*"
grep '^/oracle/' filelist |grep '/sapdata$'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 08:10 AM
тАО08-23-2005 08:10 AM
Re: How to grep using "*"
have a look at this page, it gives a good idea how to use wildcard with grep.
(You'll have more fun than reading a man page)
Many examples for beginners!
http://pegasus.rutgers.edu/~elflord/unix/grep.html#wildcards
Hope this helps!
Regards
Torsten.
__________________________________________________
There are only 10 types of people in the world -
those who understand binary, and those who don't.
__________________________________________________
No support by private messages. Please ask the forum!
If you feel this was helpful please click the KUDOS! thumb below!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 08:11 AM
тАО08-23-2005 08:11 AM
Re: How to grep using "*"
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 08:11 AM
тАО08-23-2005 08:11 AM
Re: How to grep using "*"
grep -v '^/oracle/' test.dat |grep -v '/sapdata$'
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 08:56 AM
тАО08-23-2005 08:56 AM
Re: How to grep using "*"
# grep -v "/oracle/*/sapdata" filelist
Otherwise the shell will try to expand the file paths.
HTH
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 10:41 AM
тАО08-23-2005 10:41 AM
Re: How to grep using "*"
# grep -v '/oracle/.*/sapdata'
should do the trick...regards!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО08-23-2005 12:30 PM
тАО08-23-2005 12:30 PM
Re: How to grep using "*"
grep with a combination of -v and some quotations around your search string just might do the trick.
Peace and Chicken Grease,
John E. Ophious