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

Submitted by:  None
Submitted on:  Tue 10 Jun 2008 11:12:05 PM UTC  
 
Category: NoneSeverity: 3 - Normal
Item Group: NoneStatus: None
Privacy: PublicAssigned 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
-unavailable-

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 bonzini (Posted a comment)
  • -unavailable- added by bens (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
    Fri 04 Dec 2009 07:23:11 PM UTCbonziniOpen/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.1-cleanup1