[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: grep
From: |
Holger Lehmann |
Subject: |
Re: grep |
Date: |
Tue, 25 Jun 2002 17:53:28 +0200 |
Am Dienstag, 25. Juni 2002 17:28 schrieb Alfred M. Szmidt:
> * Holger Lehmann writes:
--snipp--
> > I was working on old data. There is an example included in test.txt.
> > This old data sometimes contains an "empty" row with a "backspace" (\b or
> > ^H resp. 0xa0) at the beginning of the line.
> > I wanted to skip these lines.
> > My initial attempt was to grep for those lines and check the outcome:
> >
> > $ grep '^\b' < test.txt > backspace.txt
>
> From the info manual for grep:
> The symbol `\b' matches the empty string at the edge of a word.
Ok, ok I admit it: *I am* stupid. I got that from some other manpage where I
found all the escape chars.
>
> Which is probobly what is happening. Grepping for an ^H works just
> fine (you can insert it with C-v C-h in bash). The file `blah'
> contains ^H's.
>
> address@hidden:~$ grep '^^H' blah | wc -c
> 5
Does not work, sorry. I tried that. Try it out and use the test.txt file
attached to my original message. You might even send me a shell script.
Typing this:
grep '^<Control-V><Control-H>' test.txt
and pressing enter yields zero lines.
Typing this:
grep '^<Control-Q><Control-V><Control-H>' test.txt
and pressing enter yields zero lines as well.
In both cases
grep '^^H' test.txt
appears on the command line.
Using the same quoting in vi and running the script has the same effect.
Now for a different idea: anyone knows if I can grep for a char when I know
the octal or hexadecimal code for it ? Like 0xa0 or 0240 ???
tr does this with \NNN for octal numbers ... I was not able to find any
equivalent for grep so far ....
(Maybe I am not only stupid but blind as well ?)
- Thanks in advance, Holger
--
-----------------------------------------------------------------
Building Bridges
-o-o-o-o---------------------------------------------------------
catWorkX GmbH
Dipl.-Ing. Holger Lehmann
Stresemannstrasse 364
22761 Hamburg
Tel: +49 (700) catWorkX
Tel: +49 (40) 89 06 46-0
Fax: +49 (40) 89 06 46-66
mailto:address@hidden
http://www.catworkx.de
http://www.catbridge.de
- grep, Tuan Nguyen, 2002/06/06
- grep, Holger Lehmann, 2002/06/25
- Re: grep, Alfred M. Szmidt, 2002/06/25
- Re: grep,
Holger Lehmann <=
- Re: grep, Alfred M. Szmidt, 2002/06/25
- Re: grep, Holger Lehmann, 2002/06/25
- Re: grep, Stepan Kasal, 2002/06/25
- Re: grep, Alfred M. Szmidt, 2002/06/25