buggrep - Bugs: bug #39706, Does not return filename if only...

 
 

You are not allowed to post comments on this tracker with your current authentication level.

bug #39706: Does not return filename if only one file matches pattern

Submitted by:  None
Submitted on:  Tue 06 Aug 2013 02:14:18 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: Invalid
Privacy: PublicAssigned to: None
Open/Closed: Closed

Tue 06 Aug 2013 03:06:14 PM UTC, comment #4:

Thanks for the clarification on this and Closing the report.

Alasdair Campbell <alasdair>
Tue 06 Aug 2013 02:24:20 PM UTC, comment #3:

Or you can use the option -H to ensure that the file name is printed.

(This option is not defined by posix.)

Stepan Kasal <kasal>
Project Member
Tue 06 Aug 2013 02:19:40 PM UTC, comment #2:

http://pubs.opengroup.org/onlinepubs/9699919799/utilities/grep.html, look at the STDOUT section.

Eric Blake <ericb>
Project Member
Tue 06 Aug 2013 02:17:27 PM UTC, comment #1:

Not a bug; this behavior is required by POSIX. That's why you'll often find recipes such as:

xargs grep $pattern /dev/null

which combines /dev/null (which will never match) along with your list (possible one file long) from xargs, so that grep sees at least two files, and starts listing file names.

Eric Blake <ericb>
Project Member
Tue 06 Aug 2013 02:14:18 PM UTC, original submission:

If I run grep without the -r flag looking for a string (Incomplete in this case but it doesn't matter) using the string /.php for the files argument and only one file matches this pattern grep does not return the file name as part of the search.

Example:
grep Incomplete /.php

Expected:
path/filename.php: $this->markTestIncomplete();

Actual:
$this->markTestIncomplete();

Anonymous

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -unavailable- added by alasdair (Posted a comment)
  • -unavailable- added by kasal (Posted a comment)
  • -unavailable- added by ericb (Posted a comment)
  •  

    Do you think this task is very important?
    If so, you can click here to add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

    Please enter the title of George Orwell's famous dystopian book (it's a date):

     

     

    Follow 2 latest changes.

    Date Changed By Updated Field Previous Value => Replaced By
    Tue 06 Aug 2013 02:19:40 PM UTCericbStatusNone=>Invalid
      Open/ClosedOpen=>Closed

    Back to the top


    Powered by Savane 3.1-cleanup1