It's a null character (hex code 00). Vi is a great help here, if you put the cursor over a character and type 'ga', it gives you the hex code of the character.
Sed should be able to replace this using '\x00' as the character (since it's a null character). You may be better off using a utility not intended for text processing, however, since it's not really text. Presence of null bytes very nearly always represents a non-text (i.e. binary) file; which is why gedit couldn't recognize the character encoding. Notepad doesn't display unrecognized characters, and wordpad displays rectangles, as you noted. Vi displays the control sequence for the byte (this is entered by hitting Ctl-V Ctl-@). In almost any command line utility, that will give you a null character, but some programs don't handle that nicely. 2011/3/21 Henrique Rennó <[email protected]> > Yes, I know, I tried it, but I don't know why it doesn't work. I think > the character in the file is another one. I'm using Debian Alpha Linux > at work, sed 4.1.5. When I open the file with nedit it shows me the > character as <nul> and with vi as ^@, while gedit can't recognize the > character coding. Opening in notepad inside Windows it shows nothing > and with wordpad some rectangles are shown. > > As I mentioned, I tried passing inside the script the following: <TAB> > (a tab character typed from keyboard), ^I, ^@ and \t, but none of them > worked. I contacted the person responsible for the data I receive to > see if he can say what's the character written in the file, but I > don't know if he has access to source code. I'll keep trying some > other alternatives as ex and vi reading commands using redirection > from a file. > > On Mon, Mar 21, 2011 at 2:08 PM, Daniel Eggleston <[email protected]> > wrote: > > Ok, then do what I said. Use "\t". > > > > > > 2011/3/21 Henrique Rennó <[email protected]> > >> > >> I'd like to execute sed inside a C Shell script. > >> > >> On Mon, Mar 21, 2011 at 11:54 AM, Daniel Eggleston <[email protected]> > >> wrote: > >> > \t usually works, depending on the sed implementation. (GNU sed allows > >> > \t) > >> > > >> > If you're typing this on the cmd line, you can type "^V[tab]" - > >> > Control-V, > >> > then hit tab. This will put a literal tab (instead of letting the > shell > >> > interpret the tab). > >> > > >> > 2011/3/21 Henrique Rennó <[email protected]> > >> >> > >> >> Hello, > >> >> > >> >> I'd like to know how it's possible to solve the following problem: > >> >> > >> >> I have a file with the following pattern: > >> >> > >> >> this is some text<TAB><TAB><TAB> > >> >> and this is another text<TAB><TAB><TAB> > >> >> > >> >> I want to change that text into: > >> >> > >> >> this is some text<SPACE>some text<SPACE>some text<SPACE>some text > >> >> and this is another text<SPACE>some text<SPACE>some text<SPACE>some > >> >> text > >> >> > >> >> I want to substitute every <TAB> pattern by <SPACE>some text > >> >> > >> >> The problem is that I need it inside a C Shell script, that is: > >> >> > >> >> if(-e myfile.txt)then > >> >> sed "s/<TAB>/<SPACE>some text/g" myfile.txt > myanotherfile.txt > >> >> endif > >> >> > >> >> I also tried using ex and vi, but with no success: > >> >> > >> >> ex: > >> >> > >> >> cat << EOF >! ex.cmd > >> >> %s/^I/ some text/g > >> >> . > >> >> wq > >> >> EOF > >> >> ex - myfile.txt < ex.cmd > >> >> > >> >> vi: > >> >> > >> >> cat myfile.txt << EOF > /dev/null > >> >> %s/\t/ some text/g ; also: %s/<TAB>/ some text/g, where <TAB> is a > >> >> typed tab character; %s/^@/ some text/g; %s/^I/ some text/g > >> >> wq > >> >> EOF > >> >> > >> >> Is there another pattern for TAB besides the ones I tried? The TAB > >> >> character isn't being changed in any way. If I open the file with vi > >> >> and try chaging it, it works great with no problem. When opening the > >> >> file, tabs are shown as ^@. > >> >> > >> >> Thanks > >> >> > >> >> -- > >> >> Henrique > >> >> > >> >> -- > >> >> You received this message because you are subscribed to the Linux > Users > >> >> Group. > >> >> To post a message, send email to [email protected] > >> >> To unsubscribe, send email to > >> >> [email protected] > >> >> For more options, visit our group at > >> >> http://groups.google.com/group/linuxusersgroup > >> > > >> > > >> > -- > >> > > >> > Daniel > >> > > >> > -- > >> > You received this message because you are subscribed to the Linux > Users > >> > Group. > >> > To post a message, send email to [email protected] > >> > To unsubscribe, send email to > >> > [email protected] > >> > For more options, visit our group at > >> > http://groups.google.com/group/linuxusersgroup > >> > >> > >> > >> -- > >> Henrique > >> > >> -- > >> You received this message because you are subscribed to the Linux Users > >> Group. > >> To post a message, send email to [email protected] > >> To unsubscribe, send email to > [email protected] > >> For more options, visit our group at > >> http://groups.google.com/group/linuxusersgroup > > > > > > -- > > > > Daniel > > > > -- > > You received this message because you are subscribed to the Linux Users > > Group. > > To post a message, send email to [email protected] > > To unsubscribe, send email to > [email protected] > > For more options, visit our group at > > http://groups.google.com/group/linuxusersgroup > > > > -- > Henrique > > -- > You received this message because you are subscribed to the Linux Users > Group. > To post a message, send email to [email protected] > To unsubscribe, send email to [email protected] > For more options, visit our group at > http://groups.google.com/group/linuxusersgroup > -- Daniel -- You received this message because you are subscribed to the Linux Users Group. To post a message, send email to [email protected] To unsubscribe, send email to [email protected] For more options, visit our group at http://groups.google.com/group/linuxusersgroup
