Checking for invalid chars


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Checking for invalid chars
# 1  
Old 03-07-2005
Checking for invalid chars

Hi there!
Can you please tell me how to check for ctrl chars or noprintable chars in a batch file ??
I suspect that some of my file is corrupted by those chars and i dont know how to chase them ...

Thanks a lot!
# 2  
Old 03-07-2005
You could use od -tc to view the file.... I created a quick junk file, take a look....
Code:
$ od -tc ctrltest
0000000  007     002      \r      \t      \n      \b 020 017  \t 025  \n
0000020    h   e   l   l   o  \n
0000026

As you can see, there are standard characters, and non-printing/control chars there. Some are represented by their octal value - check man ascii to see what they are.

Read the man page for od - there are a plethora of output formatting options available to help you.

Cheers
ZB
# 3  
Old 04-03-2005
you could also use ...
Code:
cat -v file

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Shell script to split data with a delimiter having chars and special chars

Hi Team, I have a file a1.txt with data as follows. dfjakjf...asdfkasj</EnableQuotedIDs><SQL><SelectStatement modified='1' type='string'><! The delimiter string: <SelectStatement modified='1' type='string'><! dlm="<SelectStatement modified='1' type='string'><! The above command is... (7 Replies)
Discussion started by: kmanivan82
7 Replies

2. UNIX for Dummies Questions & Answers

number of chars

I am curious why the below returns 4 instead of 3 wc -c <<<aaa Whereasa=aaa;echo ${#a} returns 3. How to get 3 using here -string operator in the above scenario Thanks (2 Replies)
Discussion started by: pandeesh
2 Replies

3. SCO

Stop boot system at "Checking protected password and checking subsystem databases"

Hi, (i'm sorry for my english) I'm a problem on boot sco unix 5.0.5 open server. this stop at "Checking protected password and checking subsystem databases" (See this image ) I'm try this: 1) http://www.digipedia.pl/usenet/thread/50/37093/#post37094 2) SCO: SCO Unix - Server hangs... (9 Replies)
Discussion started by: buji
9 Replies

4. UNIX for Dummies Questions & Answers

Find all chars before .

Howdy, I need a command which will find all of the characters in a line before the first . I am using Korn Thank you (3 Replies)
Discussion started by: jgrosecl
3 Replies

5. Shell Programming and Scripting

op is invalid

In the following code a= echo $? echo $? Why the op is (2 Replies)
Discussion started by: lipun4u
2 Replies

6. Shell Programming and Scripting

find 4 chars on 2nd line, 44 chars over

I know this should be simple, but I've been manning sed awk grep and find and am stupidly stumped :( I'm trying to use sed (or awk, find, etc) to find 4 characters on the second line of a file.txt 44-47 characters in. I can find lots of sed things for lines, but not characters. (4 Replies)
Discussion started by: unclecameron
4 Replies

7. UNIX for Dummies Questions & Answers

Euro Sign and some other chars

First of all hello, this is my first post here. :) I have a problem with displaying the euro sign and two other characters from the ISO8859-7 greek set (the drachma sign and the ipogegrameni) in the UNIX platform. Either when I type them normally or if i try to read a text file with some of... (2 Replies)
Discussion started by: pavlos87
2 Replies

8. Shell Programming and Scripting

How to convert C source from 8bit chars to 16bit chars?

I was using the following bash command inside the emacs compile command to search C++ source code: grep -inr --include='*.h' --include='*.cpp' '"' * | sed "/include/d" | sed "/_T/d" | sed '/^ *\/\//d' | sed '/extern/d' Emacs will then position me in the correct file and at the correct line... (0 Replies)
Discussion started by: siegfried
0 Replies

9. Shell Programming and Scripting

cut last 4 chars

hi i wanted to cut last 4 chars from a text file Input A-B-C-V-15-0115 A-BL-CLE-T-VALUE-0125 M-T-L-G-0115 AT-PR-PE-CCT-0135 Output 0115 0125 0115 0135 I tried cut -f - -d "-" (thinking cut -f 5- -d"-" gives 5 ot end of line so only - should give last but floped) (5 Replies)
Discussion started by: pbsrinivas
5 Replies

10. Shell Programming and Scripting

replace chars,

:rolleyes: Hi, I want to replace the particular text in the middle of the line. Ex. In the line 40-50 wanted to replace the char as 'x' (7 Replies)
Discussion started by: Jairaj
7 Replies
Login or Register to Ask a Question