buggrep - Bugs: bug #23535, Grep Doesn't Support \t as a tab...

 
 

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

bug #23535: Grep Doesn't Support \t as a tab character

Submitter:  None
Submitted:  Tue 10 Jun 2008 11:12:05 PM UTC
   
 
Category:  None Severity:  3 - Normal
Item Group:  None Status:  None
Privacy:  Public Assigned to:  None
Open/Closed:  Closed

Fri 04 Dec 2009 07:23:11 PM UTC, comment #2: 

The workaround is the correct solution.  sed is not grep.

Paolo Bonzini <bonzini>
Wed 11 Jun 2008 08:37:43 PM UTC, comment #1: 

It is not entirely clear how exactly you are searching for tabs.  It would have been better to provide actual examples, pasting them together with their output.  For example:

$ echo -e "\t : words" | grep '\t'
$ echo -e "\t : words" | grep $'\t'
         : words
$ echo -e "\t : words" | sed 's/\t/xx/'
xx : words

In 'info sed' there is this:

`\CHAR' [...]
    Note that the only C-like backslash sequences that you
    can portably assume to be interpreted are `\n' and `\\';
    in particular `\t' is not portable, and matches a `t'
    under most implementations of `sed', rather than a tab
    character.

Nowhere in 'info grep' I see mention of "\t", so grep's regular expressions apparently do not support it -- possibly to avoid problems when porting scripts.

Benno Schulenberg <bens>
Tue 10 Jun 2008 11:12:05 PM UTC, original submission:  

Hi,

When using grep to search for tab characters it doesn't seem to recognize \t. Rather it recognizes \t as the letter t.  Is this the way it is meant to function?  The work around if using grep from bash is $'\t' instead of '\t'.

I am using GNU grep 2.5.3

Thank you,
Kyle Brandt
-email is unavailable-

Anonymous

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by bonzini (Posted a comment)
  • -email is unavailable- added by bens (Posted a comment)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 2 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-12-04 bonzini Open/ClosedOpen Closed
        SummaryGrep Doesn\'t Support \\t as a tab character Grep Doesn't Support \t as a tab character

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code