How to see junk character in file in.?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to see junk character in file in.?
# 8  
Old 12-05-2013
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
# 9  
Old 12-06-2013
Hi Jim

below is the o/p of locale command.

Code:
 
 locale
LANG=en_US
LC_COLLATE="en_US"
LC_CTYPE="en_US"
LC_MONETARY="en_US"
LC_NUMERIC="en_US"
LC_TIME="en_US"
LC_MESSAGES="en_US"
LC_ALL=

# 10  
Old 12-06-2013
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.
# 11  
Old 12-06-2013
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...

Using CygWin...
Code:
AMIGA:~> echo -n " 10.178.14.67▒▒▒ ac01sp02-vip" > /tmp/text
AMIGA:~> od -tx1 /tmp/text
0000000 20 31 30 2e 31 37 38 2e 31 34 2e 36 37 e2 96 92
0000020 e2 96 92 e2 96 92 20 61 63 30 31 73 70 30 32 2d
0000040 76 69 70
0000043
AMIGA:~> _

# 12  
Old 12-12-2013
Hi Rudic/Wisecracker,

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.

Code:
# 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.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Emergency UNIX and Linux Support

Help in viewing the junk character

Hello All, I have issues in unix file when I loaded that to database and do select * from table where description like '%'+char(13)+'%' on it I am able to get records. I tried to view the file in unix it is all having blank character which I think is all non ascii which I am not able view.... (11 Replies)
Discussion started by: arunkumar_mca
11 Replies

2. Shell Programming and Scripting

Junk character appearing after downloading the file from windows server

Hello, Im downloading the file from windows server through FTP, the downloaded file is containing some junk character at very start of the file as below and causing my whole script is to fail, how to download without junk or how to remove these before processing it? ▒▒"nmdbfnmdsfsdf" ... (19 Replies)
Discussion started by: Riverstone
19 Replies

3. Shell Programming and Scripting

removing of junk character

Dear ALL, How to remove junk charecter ^M from unix file i am using sun solaris unix. I already tried few commands :%s/^M//g :%s/r//g but it didnt helped me. Any help appriciated. Thanks Ripudaman Please view this code tag video for how to use code tags when posting code... (5 Replies)
Discussion started by: ripudaman.singh
5 Replies

4. Shell Programming and Scripting

Check Junk character in sql file

Hello, I have two .sql files which I transferred from Windows to Unix (Linux Enterprise Linux Server release 5.3).I want to ensure that these two files have no junk characters in them.How do I do it in the simplest possible way? Many thanks DJ (1 Reply)
Discussion started by: Digjoy83
1 Replies

5. UNIX for Dummies Questions & Answers

how to grep junk characters in a file

hi guys, I am generating a file from datastage (an etl tool). Now the file is having some junk characters like ( Á,L´±,ñ and so on).. I want to use the grep function to figure out all the junk characters and their location. Can somebody help me out in finding it out.. if possible i... (1 Reply)
Discussion started by: mac4rfree
1 Replies

6. Shell Programming and Scripting

Junk Character appended at the end of a line

Hi All I have a rather unusual problem, which i have not faced till now. I have a script which exports some paths to a text file. The script runs fine but when i check the output file i can see some junk characters ^M appended at end of lines and random places. I am not able to figure... (4 Replies)
Discussion started by: raghu_shekar
4 Replies

7. Shell Programming and Scripting

Remove all JUNK character from file.

Hi Team, I have a file having size greater than 1 GB. What i want to do is to check if it contains any JUNK character (ie any special charater thats not on the key board stroke). This file has 532 column & seperated with ^~^. I have found some solution from the file, but it is for a... (4 Replies)
Discussion started by: Amit.Sagpariya
4 Replies

8. Shell Programming and Scripting

Junk Character in file

Hi set filename "./GopiRun.sh" if } err] { writeLog "error in exec " writeLog $a } else { writeLog $a } The above code will execute a file GopiRun.sh,and will log the output of the exec to a file. The problem is the file has lot of junk character in it,how to avoid it. The... (2 Replies)
Discussion started by: nathgopi214
2 Replies

9. UNIX for Dummies Questions & Answers

How to remove junk (^Ò) character while FTPing

Hi All, I have been trying to FTP some data files from Windows directory to a UNIX server. The txt file in the windows contails the following data: "111~XYZ~1~Contact person’s phone number~COMMENTS~~~~" but the same line is appearing as "111~XYZ~1~Contact person^Òs phone number~COMMENTS~~~~"... (8 Replies)
Discussion started by: vkumbhakarna
8 Replies

10. UNIX for Advanced & Expert Users

Get rid of junk character in a file

I have a file with one of the following lines, when opened with vi 33560010686GPT£120600GBPGBP10082007DS In the above line, I want to get rid of the junk character before the £ (pound sysmbol). When I tried copying £ from windows and copy in unix vi, it prints as £ and I tried pattern replace... (2 Replies)
Discussion started by: nskworld
2 Replies
Login or Register to Ask a Question