The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Operating Systems > BSD
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 02-27-2009
joeyg's Avatar
joeyg joeyg is offline Forum Staff  
modérateur
  
 

Join Date: Dec 2007
Location: Home of 17-time world champion Boston Celtics
Posts: 1,311
Cool

grep will return all lines that contain a searched-for string.
And I have seen some odd results when the lines are not delimited as usually expected with a line-feed at the end of each. So, that is a first thought - that your file is not correctly delimited. (see commands like dos2unix and unix2dos for more on this)
The next issues are capitalization and spacing. The grep command, without additional options, is an exact match. This relates to my comment on spacing as there might be two spaces between certain words, they words may be on separate lines, there could be tab characters between the words.

See the following example:
Code:
> cat file002
this is boring
but I am writing
so we can test
to see that I
am writing
> grep "I am writing" file002
but I am writing