The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


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 !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
finding string at runtime inderpunj Shell Programming and Scripting 1 05-01-2008 12:19 AM
While finding compare the result with given string mr_bold UNIX for Dummies Questions & Answers 4 04-24-2008 06:31 PM
finding a string in a file Ume1986 UNIX for Advanced & Expert Users 2 01-24-2008 04:19 AM
help with finding a string sandyg Shell Programming and Scripting 2 09-28-2007 07:15 AM
Finding part of a string DAFNIX Shell Programming and Scripting 4 09-20-2006 08:24 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1  
Old 04-01-2007
Registered User
 

Join Date: Mar 2007
Location: Sydney
Posts: 5
Finding funny charaters in a string

Hi,

I have got a little problem where some of the files I created had some funny characters e.g space ,"^M" etc inserted in the full file name and which caused our backup script to skip those files.
Is it possible to find out if there are any funny charaters in a string ?

Thanks,
Reply With Quote
Forum Sponsor
  #2  
Old 04-01-2007
mona's Avatar
Registered User
 

Join Date: Nov 2005
Location: Singapore
Posts: 96
Code:
cat -vet <filename>
This will display all the control characters. ^ and $ represents the start and end of Line.
Reply With Quote
  #3  
Old 04-01-2007
Registered User
 

Join Date: Mar 2007
Location: Sydney
Posts: 5
Mona,

Thanks for that and also could you please advise code in finding characters other than ASCII from a string e.g between chr(49) and chr(122).

Thanks
Reply With Quote
  #4  
Old 04-01-2007
mona's Avatar
Registered User
 

Join Date: Nov 2005
Location: Singapore
Posts: 96
Try this

Code:
 egrep '[^]0-9a-zA-Z:;<>=\?@\[\\\^\_`]' <filename>
Reply With Quote
  #5  
Old 04-01-2007
Registered User
 

Join Date: Mar 2007
Location: Sydney
Posts: 5
Mona,

Thanks for that. Could we include "/" as legitmate part of the string, as I am using full path name for the files.

Best regards
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 12:10 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0