Results 1 to 5 of 5
Hi,
I have special character ^@ at my ksh script.
It is running on HP-UX,SunOs,AIX but on Linux it is failing.
The script is :
Code:
> cat -v test.ksh
...
- 11-20-2008 #1Just Joined!
- Join Date
- Nov 2008
- Posts
- 6
remove special characters ^@ in ksh script
Hi,
I have special character ^@ at my ksh script.
It is running on HP-UX,SunOs,AIX but on Linux it is failing.
The script is :
When i running it , i get the following error:Code:> cat -v test.ksh #! /bin/ksh echo ^@test^@
What is this character and how can i remove it (may be by sed).Code:> ./test.ksh ./test.ksh: syntax error at line 2: `zero byte' unexpected

Thanks a lot
- 11-20-2008 #2Just Joined!
- Join Date
- Apr 2007
- Posts
- 59
You can remove it using sed like this:
Code:cat test.ksh | sed 's/^@//g' > test2.ksh mv test2.ksh test.ksh
- 11-20-2008 #3Just Joined!
- Join Date
- Nov 2008
- Posts
- 6
^@ it is not 2 characters, it 's one special character like ^M.
i already found the answer:
^@ in ascii (Hexadecimal ) it's 00
so the solutin is
Thanks.Code:sed 's/\x00//g' file
- 11-20-2008 #4Linux Newbie
- Join Date
- Jul 2008
- Posts
- 181
- 11-20-2008 #5burschik is correct from two angles:That can't work, since "/^@/" means "@" at the beginning of a line.
- He knows his stuff, and (no surprise) his stuff here is correct.
- Just for fun, I tried it, and he's right.
And with:
alexvai is correct; I tried that one, too.Code:sed 's/\x00//g' file
But sandeep t is almost there as well. This will work:
but this is better:Code:cat test.ksh | sed 's/\c@//g' > test2.ksh
You can find additional information on "useless uses of cat" here.Code:sed 's/\c@//g' test.ksh > test2.ksh
--
Bill
Old age and treachery will overcome youth and skill.


Reply With Quote
