In my WindowsXP/dos window, how do I grep for a tab?
I try
> grep "\t" file.txt
which gives me every line with a "t" in it, not tab.
Thank you
In my WindowsXP/dos window, how do I grep for a tab?
I try
> grep "\t" file.txt
which gives me every line with a "t" in it, not tab.
Thank you
When you parse the string "\t", instead look for a tab character.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
Do you mean to hit the tab key instead of typing \t?Originally Posted by Dave_Sinkula
(When I hit the tab key, doskey brings up file names)
No I mean interpret the character string "\t" to mean the tab character when you do a search.
Code:#include <stdio.h> int main(int argc, char *argv[]) { while ( *argv ) { printf("*argv = \"%s\"\n", *argv++); } return 0; } /* my output H:\test>test "\t" file.txt *argv = "H:\test\test.exe" *argv = "\t" *argv = "file.txt" */
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
Dave,
I have no idea what you are talking about. You wrote a C program, which I understand.
I want to execute a grep from a dos prompt.
I am grepping the output of a C program (ctags). I want to print out all lines with a tab.
Are you with me this far?
My grep command, at the dos prompt, should look something like this:
>grep x file.txt
I don't know what x is. I want to print out all lines in file.txt which have a tab.
[edit]Sorry, I'm reading this wrong.
Last edited by Dave_Sinkula; 12-25-2005 at 10:06 PM.
7. It is easier to write an incorrect program than understand a correct one.
40. There are two ways to write error-free programs; only the third one works.*
Dave, thank you for trying, I appreciate it.
Why are you trying to look for a tab? You might try \s, which matches a whitespace character . . . .
[edit]
Or you can write your own program to do it.
[/edit]
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.