Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
?
Solved

Grep two words (logical OR)

Posted on 2005-03-31
2
Medium Priority
?
7,550 Views
Last Modified: 2013-12-16
How can I tell grep to return lines with either one of two words?

grep "this|that" file

Is that correct?
0
Comment
Question by:phasevar
2 Comments
 
LVL 22

Accepted Solution

by:
pjedmond earned 500 total points
ID: 13674907
Unfortunately ...not quite...you need to escape the  | otherwise you'll get an error:

grep "this\|that" file

Try here for an excellent tutorial:

http://pegasus.rutgers.edu/~elflord/unix/grep.html

HTH:)
0
 

Author Comment

by:phasevar
ID: 13674958
Thank you!
0

Featured Post

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction We as admins face situation where we need to redirect websites to another. This may be required as a part of an upgrade keeping the old URL but website should be served from new URL. This document would brief you on different ways ca…
The purpose of this article is to demonstrate how we can use conditional statements using Python.
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month13 days, 6 hours left to enroll

578 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question