- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- script/cmd required for avoiding the lines contain...
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
12-22-2003 02:48 AM
12-22-2003 02:48 AM
Re: script/cmd required for avoiding the lines containing a search word
grep -E -v ('^mathi ' or ' mathi$' or '^mathi$' or ' mathi ')
means: exclude all lines, which have a mathi at the start and a blank following, a mathi at the end, preceeded by a blank, mathi alone on a line and mathi preceeded and followed by a blank.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-22-2003 03:04 AM
12-22-2003 03:04 AM
Re: script/cmd required for avoiding the lines containing a search word
If grep -v ' mathi ' displays the whole file ... then perhaps you don't really have spaces between words, or at least not only spaces.
You could check using 'cat -t file' to make tabs visible. if you have a mix of tabs and spaces, rather use :
grep -v -E '^mathi[[:blank:]]|[[:blank:]]mathi[[:blank:]]|[[:blank:]]mathi$' /tmp/a | awk '
or replace [[:blank:]] which means 'space or tabs' class (I've only found description of classes in 'man tr') by [
Regards.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-25-2003 10:41 PM
12-25-2003 10:41 PM
Re: script/cmd required for avoiding the lines containing a search word
You please consider my I/p file.....in that the word "mathi" is surrounded by a single blank space only......and not tab......that is why I am very very much confused why "grep -v -E ' mathi ' i/p" is not giving me the correct o/p.....
Also can u pls give some GOOD links for learning Sh Scripting, awk & sed...or if u have any DOC can u pls attach it.....so that I can start learning......
regards,
karthik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-26-2003 12:12 AM
12-26-2003 12:12 AM
Re: script/cmd required for avoiding the lines containing a search word
grep -v -E ' mathi ' i/p is not giving the right output because it only eliminates line with mathi and a blank on both sides, which means ' mathi' at the end of the line is not excluded. With the option -E you can specify more that one pattern. They must be separated by |. These patterns are evaluated with logical or, meaning that if any one of them is in the line, the line qualifies for the grep and when you specify -c, then this means instead of inluding those lines, exclude them.
greetings,
Michael
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2003 09:40 PM
12-28-2003 09:40 PM
Re: script/cmd required for avoiding the lines containing a search word
Thank you you very very much.....I got it....
Can you pls give me some GOOD DOC links for learning Sh Scripting, awk & sed...etc
regards,
karthik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-28-2003 09:54 PM
12-28-2003 09:54 PM
Re: script/cmd required for avoiding the lines containing a search word
Mastering Regular Expressions
2nd edition
Jeffrey E.F.Friedl
O'Reilly ISBN 0-596-00289-0
http://www.oreilly.com/catalog/regex2/index.html
Enjoy, Have Fun! H.Merijn
- « Previous
-
- 1
- 2
- Next »