Finding funny charaters in a string


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Finding funny charaters in a string
# 1  
Old 04-01-2007
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,
# 2  
Old 04-01-2007
Code:
cat -vet <filename>

This will display all the control characters. ^ and $ represents the start and end of Line.
# 3  
Old 04-02-2007
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
# 4  
Old 04-02-2007
Try this

Code:
 egrep '[^]0-9a-zA-Z:;<>=\?@\[\\\^\_`]' <filename>

# 5  
Old 04-02-2007
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
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filter ONLY lines with non-printing charaters

I have a file contains data with non-printing characters. i have used cat -v filename to display whole data with non-printing characters also. However, i need lines with non-printing characters into seperate file. My file is huge and looks like i have to manully find lines using cat -v filename |... (3 Replies)
Discussion started by: JSKOBS
3 Replies

2. UNIX for Dummies Questions & Answers

Find and replace mulitple charaters in filenames

I have a virtual pdf printer set up on my server which produces files with the following prefix: smbprn_00000044_Microsoft_Word_-_OriginalFilename.pdfthe number in the center of the file increase by one for each new file. I want to remove all the charaters infront of OriginalFilename.pdf using... (14 Replies)
Discussion started by: barrydocks
14 Replies

3. Shell Programming and Scripting

Finding a string with another string is found

finding a string with another string is found EX: abs c/- i want to find /-, then copy abs. i know it's easy use awk, but my problem is the substr syntax. substr($2,2,2) will give me /- but the conflict is /- is not always the second characted of the second string. (11 Replies)
Discussion started by: engr.jay
11 Replies

4. UNIX for Advanced & Expert Users

replace word with special charaters

I have input file called file1 with characters that have \\ in it. I cannot change input file, because it is generated earlier in script. Now would like to replace string on line in file called bfile with output from file1 I have been using sed command. $cat file1 pc//6sPxp== $ cat scr1... (4 Replies)
Discussion started by: drtabc
4 Replies

5. Shell Programming and Scripting

printing positional charaters in a loop

#!/bin/bash usep=`df -hT | awk '{ print $5 }'` for (1=1,1<8,i++) output=`echo $usep | awk '{ print $i }'| cut -d'%' -f1` echo $output if then echo "critical value" i need to echo critical value if disk usage pecentage xceeds 10 and i am face problem in position marked red here i... (9 Replies)
Discussion started by: josgeorge
9 Replies

6. Shell Programming and Scripting

Problem with awk while handling special charaters

Hi, I have an application.xml file like </dependency> <artifactId>_AdminServicesEAR</artifactId> <version>1.0.0-20080521.085352-1</version> <context-root>oldvalue</context-root> <type>ear</type> <DOCTYPE "abc/xyz/eft"> <NewTag>value123</xyz> ... (4 Replies)
Discussion started by: subin_bala
4 Replies

7. Shell Programming and Scripting

help with finding a string

Hello folks I have a text file abcd.txt and has a line starting with number '8'. I have a string in this line starting at position 'a' to position 'b' also this string is a number and have to be reduced by 1. there is also a problem that it has to be padded with zeros to make the string... (2 Replies)
Discussion started by: sandyg
2 Replies

8. Programming

inb(); not reading charaters as expected

I am sorry if this is in any way against the rules; the code isn't intended to be malicious, though it could be. If it is that bad, please delete/lock the thread instead of banning me. So, I'm creating a keylogger, and it's not working as expected. Currently the program reads directly into the... (13 Replies)
Discussion started by: Octal
13 Replies

9. UNIX for Dummies Questions & Answers

how to check a file to contain only ascii charaters

HI I need to validate a file in UNIX to contain only ascii characters.This is a production issue.Can anyone help with the command? Thanks Subbarao (1 Reply)
Discussion started by: srichakra9
1 Replies

10. Shell Programming and Scripting

Non-ASCII charaters in a unix file

Hi, Could you pls help me with the command to know the non-ascii characters in a unix file. Thanks (1 Reply)
Discussion started by: gaurav_gaba
1 Replies
Login or Register to Ask a Question