To get the invalid characters from a file | Unix Linux Forums | UNIX for Dummies Questions & Answers

  Go Back    


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

To get the invalid characters from a file

UNIX for Dummies Questions & Answers


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 12-21-2012
schandru schandru is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 11 November 2013, 8:02 AM EST
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
To get the invalid characters from a file

Hello,

Can any one help me in below query to search all the invalid characters that UNIX cannot recognize from a file. can we do anything with the help of grep command or any other commands.

Also, i am not sure what are the invalid characters present in the file.

Many thanks in advance.

Regards,
Chandru
Sponsored Links
    #2  
Old 12-21-2012
RudiC RudiC is offline Forum Advisor  
Registered User
 
Join Date: Jul 2012
Last Activity: 22 October 2014, 11:35 AM EDT
Location: Aachen, Germany
Posts: 4,414
Thanks: 73
Thanked 1,077 Times in 1,016 Posts
I'm pretty sure you won't get any other reply to this post. You don't specify the problem, you don't post input nor output files, the query you are referring to is missing - what kind of help do you expect?
Sponsored Links
    #3  
Old 12-21-2012
schandru schandru is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 11 November 2013, 8:02 AM EST
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Hi,
Today i faced a problem in which the file at Unix had the characters like � and it caused the file processing failure at downstream end which is Mainframe. and it somehow identified by the Mainframe and notified to me, so i removed the above mentioned by going to the particular line and removed the characters and it got processed successfully.

Could you please help me to find these characters like non-standard characters in a file?

Hope now this makes sense and clear..!

Chandru.
    #4  
Old 12-21-2012
rangarasan's Avatar
rangarasan rangarasan is offline
Registered User
 
Join Date: Jul 2011
Last Activity: 2 September 2014, 7:23 AM EDT
Location: Chennai, India
Posts: 496
Thanks: 9
Thanked 124 Times in 120 Posts
perl

Hey,

Just make a try with your input file.


Code:
perl -nle 'chomp($_);if(my @a = $_ =~ m/(\P{IsASCII})/g){print "@a";}' input_file

Cheers,
Ranga
Sponsored Links
    #5  
Old 12-21-2012
schandru schandru is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 11 November 2013, 8:02 AM EST
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Hi Ranga,

Thanks for your input. I will try it out and post the output of it.

Chandru.

---------- Post updated at 07:17 AM ---------- Previous update was at 06:56 AM ----------

Hi Ranga,

Thank you. It works..

It displays the output as



is displayed the characters as i had given .

Could you please help me further in understanding your script to find out these characters from the file. Also can you please let me know what are all the non-standard characters this script includes?

- Chandru.
Sponsored Links
    #6  
Old 12-21-2012
rangarasan's Avatar
rangarasan rangarasan is offline
Registered User
 
Join Date: Jul 2011
Last Activity: 2 September 2014, 7:23 AM EDT
Location: Chennai, India
Posts: 496
Thanks: 9
Thanked 124 Times in 120 Posts
Hey,

What we are doing this script is, just printing the character which don't comes under ASCII standard.

It will display the characters which not comes under ASCII table.

Cheers,
Ranga
Sponsored Links
    #7  
Old 12-21-2012
schandru schandru is offline
Registered User
 
Join Date: Dec 2012
Last Activity: 11 November 2013, 8:02 AM EST
Posts: 5
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks Ranga..
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Remove invalid database characters on a file Jin_ Shell Programming and Scripting 1 10-28-2011 01:38 AM
writing shell script to find line of invalid characters beginner82 Shell Programming and Scripting 3 06-04-2009 08:51 AM
string with invalid characters cleopard Programming 4 08-07-2008 04:23 PM
Invalid Characters in the file. kanu_pathak UNIX for Dummies Questions & Answers 15 02-04-2008 07:10 AM
Invalid Characters in the file. kanu_pathak Shell Programming and Scripting 5 02-01-2008 08:45 AM



All times are GMT -4. The time now is 12:32 AM.