delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/06/14/09:06:47

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
content-class: urn:content-classes:message
Subject: RE: grep problems
MIME-Version: 1.0
Date: Mon, 14 Jun 2004 10:29:13 +0200
Message-ID: <F0D7281DAB048B438E8F5EC4ECEFBDDC1760B3@esmail.elsag.de>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: =?iso-8859-1?Q?J=F6rg_Schaible?= <Joerg DOT Schaible AT Elsag-Solutions DOT com>
To: <cygwin AT cygwin DOT com>
X-IsSubscribed: yes
Reply-To: cygwin AT cygwin DOT com
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id i5ED6jUs021235

Hi Mark,

Mark DOT Bevan AT gwent DOT wales DOT nhs DOT uk wrote on Monday, June 14, 2004 9:47 AM:

> I was having some trouble using grep to look for text in files.
> 
> From some tests it looks like meta characters cause the problem to
> show itself : 
> 
> C:\temp>type test.txt
> text
> 
> C:\temp>grep test test.txt
> text
> 
> C:\temp>grep text *.txt
> test.txt:text
> 
> C:\temp>grep text \temp\test.txt
> text

I don't know, why this works, but you may have created this file ("temptest.txt") by chance ...

> C:\temp>grep text \temp\*.txt
> GREP: temp*.txt: No such file or directory

grep is right. You have no file "temp*.txt" in your current directory

> C:\temp>grep text ..\temp\*.txt
> GREP: ..temp*.txt: No such file or directory

grep is right. You have no file "..temp*.txt" in your current directory


> C:\temp>grep text c:\temp\*.txt
> GREP: c:\temp\*.txt: No such file or directory

grep is right. You have no file "C:temp*.txt" in your current directory (assuming you're on C:)
 
> C:\temp>grep text ../temp/*.txt
> ../temp/test.txt:hello
> 
> C:\temp>grep text /temp/*.txt
> GREP: /temp/*.txt: No such file or directory

grep is right. You have no file "C:/cygwin/temp/test.txt" (assuming C:/cygwin is your root -- set as default)

> C:\temp>grep text c:/temp/*.txt
> c:/temp/test.txt:text
> 
> I have upgraded to latest release of Cygwin and this has not
> changed things. I have tried the above on a Windows 98 and
> Windows XP system as well - same results.
> 
> Any ideas how I get around this problem ?

Learn the syntax. Backslashes have to be escaped by a backslash
;-)

-- Jörg

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019