Site Map - skip to main content

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes every weekday Monday through Friday.
This page was generated by The HPR Robot at

hpr0787 :: Grep for tab

Ken submits a summer short explaining how to grep for a tab character in a file

<< First, < Previous, , Latest >>

Thumbnail of Ken Fallon
Hosted by Ken Fallon on 2011-08-08 is flagged as Explicit and is released under a CC-BY-SA license.
summer shorts. 1.
The show is available on the Internet Archive at:

Listen in ogg, spx, or mp3 format. Play now:

Duration: 00:02:38


In todays summer short Ken tells us about how you can grep for a tab in a file.
grep "first{ctrl+v}{tab}second" file.txt

for more information see


Subscribe to the comments RSS feed.

Comment #1 posted on 2011-08-26 17:01:18 by Krayon

Another way (in BASH)

Another way you can do this would be use the special $'string' expansion which is treated specially and expands string with backslash-escaped characters replaced as specified by the ANSI C standard (see under QUOTING of the bash(1) man page for more info).

You could therefore do something like this: grep "first"$'\t'"second" file.txt

This is also REALLY useful for weird characters (it supports \nnn, \U (unicode)) etc and the like.

Leave Comment

Note to Verbose Commenters
If you can't fit everything you want to say in the comment below then you really should record a response show instead.

Note to Spammers
All comments are moderated. All links are checked by humans. We strip out all html. Feel free to record a show about yourself, or your industry, or any other topic we may find interesting. We also check shows for spam :).

Provide feedback
Your Name/Handle:
Anti Spam Question: What does the letter P in HPR stand for?
Are you a spammer?
What is the HOST_ID for the host of this show?
What does HPR mean to you?