how to recognize the ^@ char

how to recognize the ^@ char

Post by honth.. » Tue, 21 Mar 2000 04:00:00




, In Unix how do "sed" recognized this character.


What is the best way to do

thanks in advance

Sent via Deja.com http://www.deja.com/
Before you buy.

 
 
 

how to recognize the ^@ char

Post by Ken Pizzi » Sat, 25 Mar 2000 04:00:00




>, In Unix how do "sed" recognized this character.

In most implementations of sed: you can't/don't.  With the beta
GNU sed-3.02.80 you can match the NUL with the \x00 escape...


>What is the best way to do

Do you want to translate it into one character, multiple
characters, or delete it altogether?  The most general solution
is problaby "use perl":
   perl -pe 's/\000/whatever/g'
though GNU tr:
   tr '\000' '!'
might be suitable.

                --Ken Pizzini

 
 
 

1. char *strcasestr(char *haystack, char *needle) a simple case independent strstr()

Well, I needed it, and so i wrote it.
Sort of fun.

Any 'optimizers' can have a go now :-)

char *strcasestr(char *haystack, char *needle)
{
/* case independent strstr */
char *hptr;
char *nptr;
char *pptr;

/* start at the beginning of haystack */
pptr = haystack;

/* for each position in haystack */
while(1)
        {
        /* starting at this position in haystack */
        hptr = pptr;
        nptr = needle;

        /* test if strings match from here on */
        while(1)
                {
                /* test for end of needle */
                if(*nptr == 0)
                        {
                        /* found match */
                        return pptr;
                        }

                /* test for end of haystack */
                if(*hptr == 0) break;

                /* test for any differences */
                if( toupper(*hptr) != toupper(*nptr) ) break;                

                /* increment positions in strings */
                hptr++;
                nptr++;

                }/* end while all characters in needle */

        /* try next position in haystack */
        pptr++;

        /* test for end of haystack */
        if(*pptr == 0) break;

        }/* end while all positions in haystack */

return 0;

2. Orchid Fahrenheit ProVideo64

3. How to make sed recognize the "\t" tab char?

4. Internet Access with Phone and TV?

5. [2.5] const char* to char* conversion in console.h

6. Supported CDROM drives

7. KernelJanitor - Change applicable char *foo to char foo[]

8. PCMCIA modem

9. how to change password length from 6 chars to 4 chars on RH6.1 ??

10. const char* to char* update in console.h

11. ?? Modem sends ~15 chars, wait 30s, 15 chars, wait 30s...??

12. SED / Line / (Need to get data from searched line from specific char to char)

13. Gnu C++ stream.h char* form(const char*, ...)