Site Map - skip to main content - dyslexic font - mobile - text - print

Hacker Public Radio

Your ideas, projects, opinions - podcasted.

New episodes Monday through Friday.

hpr0787 :: Grep for tab

<< First, < Previous, Latest >>

Host Image
Hosted by Ken Fallon on 2011-08-08 is flagged as Explicit and is released under a CC-BY-SA license.
Listen in ogg, spx, or mp3 format. | Comments (1)

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-26T17:01:18Z 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

Powered by Comment Script