I want to know how to see junk character in a file.
i am not able to see junk character using vi or cat command.
below is the junk char . which i see in host file
10.178.14.67 ac01sp02-vip
actually it should be like this
10.178.14.67 ac01sp02-vip
i am using secure CRT tool and change the setting to UTF8 encoding but still i am not able to see junk characters using VI and cat command.
please let me know if there is any command to check this.
for me anything apart from alphabets, number, hyphen sign,
underscore sing, hash sign and dot sign are consider as a junk character
However you produce that line, add a pipe symbol and either od (with parameters to modify the result to your satisfaction) or, if available, hexdump (same):
i want to know how see/check junk character in a /hosts file if present.
as i am not able to see junk character in /hosts file using vi and cat command using secure CTR .
thx
Scriptor
---------- Post updated 12-06-13 at 09:09 AM ---------- Previous update was 12-05-13 at 06:59 PM ----------
Hi Rudic,
also
cat -vet
not working for me .
it is just adding a dollar sign in the end of the file
If you cat command accepts -vet with no errors then unprintable characters are not the issue. What locale are you using - please output result of the locale command
That "junk" is the UTF8 equivalent of the 0x2592 char, a special line drawing char on the apple, possibly a "block" element. And thats what we see three times in the line. Not sure if that makes sense in your /hosts line.
As RudiC has pointed out the characters look like the ancient CGA _Extended_ ROM characters, the UTF8 _equivalent_ of the ROM decimal character 177.
If you consider the string you want to correct as binary rather then pure text then both I and RudiC have pointed you to a method that may work.
As you have no idea without looking at the rawcode in binary format what the character really is then hexdump, od or xxd is really the only quick way to find out...
In this case three binary bytes per character as we are able to detect them through _copy_n_paste_.
Binary bytes E2, 96 and 92 thrice...
here my problem is i am not able to see those junk character when i vi or cat host file.
my only concern is how should i see those junk character.
is there any way to see. at present i am using secure CRT tool.
i Googled and found below script that helps in viewing junk character through vi.
but this script is showing the junk character only when viewing the file using latest putty version and not working when do vi in secure crt.
# cat read.sh
#!/bin/sh
while read N
do
if hasjunk "$N"
then
echo "$N"
fi
done
so here my only concern is to see/figure out junk character in a host file.
thx
---------- Post updated at 09:48 PM ---------- Previous update was at 10:09 AM ----------
looking for help
---------- Post updated 12-12-13 at 08:39 PM ---------- Previous update was 12-11-13 at 09:48 PM ----------
is there any one who can help me
i am really in trouble.