LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 04-29-2006, 05:42 PM   #1
angel_tsankov
LQ Newbie
 
Registered: Apr 2006
Posts: 3

Rep: Reputation: 0
searching ofr tab characters


How can I search a file for a string that contains a tab character?
 
Old 04-29-2006, 06:29 PM   #2
burninGpi
Member
 
Registered: Mar 2006
Location: Fort McMurray, Canada
Distribution: Gentoo ~amd64
Posts: 163

Rep: Reputation: 30
using grep. Type this in a console:
Code:
grep "\t" filename
or to say if it has a tab character:
Code:
grep -q "\t" filename && echo true || echo false
 
Old 04-30-2006, 02:56 AM   #3
angel_tsankov
LQ Newbie
 
Registered: Apr 2006
Posts: 3

Original Poster
Rep: Reputation: 0
Well, the following code produces no output on terminal:

echo -e "a\tb" > f
grep "a\tb" f

Where do I go wrong?
 
Old 04-30-2006, 06:35 AM   #4
ioerror
Member
 
Registered: Sep 2005
Location: Old Blighty
Distribution: Slackware, NetBSD
Posts: 536

Rep: Reputation: 34
Quote:
Originally Posted by angel_tsankov
Well, the following code produces no output on terminal:

echo -e "a\tb" > f
grep "a\tb" f

Where do I go wrong?
grep doesn't understand \t == tab, (pcregrep does though). Either use pcregrep or just use e.g. 'a[[:space:]]b', though that will catch spaces as well as tabs.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Container/Dir/File encryption ofr chroot jail The_JinJ Linux - Security 4 12-17-2005 11:40 AM
FC 4. Modify ALT+TAB behaviour to CTRL+TAB xtracto Linux - Software 1 09-22-2005 02:06 PM
how to have no interpretation of special characters (ctrl, tab ...) in a script xround Linux - General 1 11-29-2004 07:21 AM
installing linuxant drivers ofr broadcom ww450 wireless 54g card on compaq 2580us markhod Linux - Hardware 1 10-23-2003 07:13 PM
Redirecting output of tab tab benjaminrtz Linux - General 1 04-28-2003 10:11 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 06:37 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration