- 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
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
тАО06-30-2010 11:19 AM
тАО06-30-2010 11:19 AM
how can i use grep command to get several lines with different words.
i mean for example
file contains:
pablo
roberto
ana
arturo
enrique
hugo
how can i use grep command to get the lines with words "ana" and "arturo" ?
cat file | grep ana ...how code this?
thanks in advance.
Manuales
Solved! Go to Solution.
- Tags:
- grep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2010 11:22 AM
тАО06-30-2010 11:22 AM
Re: grep command ...
i will not work with a file, i will work with the result of other command ....
i mean ... something like this:
pl1=`/etc/ping $a 512 -n 1 | grep unknown`
pl2=`/etc/ping $a 512 -n 1 | grep "bytes from"`
i do not want to use two times ping command, i want to use only one variable keeping the words unknown and/or bytes from in case exist ....
how can i use grep command here?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2010 11:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2010 11:36 AM
тАО06-30-2010 11:36 AM
Re: grep command ...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2010 11:53 AM
тАО06-30-2010 11:53 AM
Re: grep command ...
> .... taking advantage, i am not very sure about 512 number
It's the packet size. By default 'ping' uses a size of 64. Those manpages are very friendly :-) [ man ping(1M) ].
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2010 08:16 PM
тАО06-30-2010 08:16 PM
Re: grep command ...
>>how can i use grep command to get the lines with words "ana" and "arturo"
You can use below command for grep
#grep -e ana -e arturo filename
Suraj
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2010 09:31 PM
тАО06-30-2010 09:31 PM
Re: grep command ...
You can also use newlines:
grep ana^J
arturo^J
file
>JRF: This is a regular expression alternation (or).
-E uses the egrep ERE hammer. Using -e just has a series of REs.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-30-2010 10:20 PM
тАО06-30-2010 10:20 PM
Re: grep command ...
Please use following command:
#(ping 15.146.157.203 512 2 2> /dev/null) |grep -E "bytes from|unknown"
Regards,
Bhadresh