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
Printable View
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.
Do you mean to hit the tab key instead of typing \t?Quote:
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"
*/
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.
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]