Unix Command for finding Nul Characters


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Unix Command for finding Nul Characters
# 1  
Old 04-30-2005
Unix Command for finding Nul Characters

Hi Folks,


I have this windowed applescript application I use for sending out emails, it uses the Postfix daemon buit into my Mac Os X box, and a 3 SMTP servers (out of hundreds I send emails to) were refusing my messages replying "host smtp2.braspress.com.br[200.187.158.140] said: 550 Requested action not taken: NUL characters are not allowed. (in reply to end of DATA command)"

As a novice high-level programmer, I did not know that every character is represented by a hex value, and that I had two "gremlins" in my Template text (used to send out the emails after text manipulation), I mean, I had two hex values = 00.

A experienced Objective C programmer, friend of mine, taught me the what these Nul characters are and helped me removing these from my text. I was using a text application that did not show me the little gremlins.

As I move on forward with my learning, I am wondering if there is a Unix command I can use to detect these Gremlins, and so create a routine in my application to check the consistency of any text I use for sending out emails.

I thank you for your comments,

Bernardo Höhl
Rio de Janeiro - Brazil
# 2  
Old 05-01-2005
Bernardo,

Você é afortunado estar em Bazil bonito! I need to find a way down there.

You can use "octal dump" to view/parse for any such characters. Look at the output of "od -c" against the file and read the man page for "od".

Cheers,

Keith
# 3  
Old 05-01-2005
Hi kduffin,


Thanks for the help!

My man page for od says:

odhas been deprecated in favor of hexdump(1).

Hexdump,if called as ,provides compatibility for the options listed above.

I guess hexdump is about the same thing. Isn't it?

I apparently get the same results as is od...

I have learned a lot today.

Thank you!


Bernardo
 
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Request for advise on how to remove control characters in a UNIX file extracted from top command

Hi, Please excuse for posting new thread on control characters, I am facing some difficulties in removing the control character from a file extracted from top command, i am able to see control characters using more command and in vi mode, through cat control characters are not visible ... (8 Replies)
Discussion started by: karthikram
8 Replies

2. Shell Programming and Scripting

Finding first 6 characters

Hi , I'm using KSH88 I tried the following example to get the last 6 characters from a string echo 'abcdefghids' | sed 's/.*\(.\{6\}\)$/\1/' What chages i need to do to get the first 6 characters from the string my desired output should be abcdef Thank you (6 Replies)
Discussion started by: smile689
6 Replies

3. Shell Programming and Scripting

Finding Strings between 2 characters in a file

Hi All, Assuming i have got a file test.dat which has contains as follows: Unix = abc def fgt jug 111 2222 3333 Linux = gggg pppp qqq C# = ccc ffff llll I would like to traverse through the file, get the 1st occurance of "=" and then need to get the sting... (22 Replies)
Discussion started by: rtagarra
22 Replies

4. Shell Programming and Scripting

Unix command to select first few characters and last character of a line

I have a huge file and I want to select first 10 charcters and last 2 characters of everyline and than will filter the unique line. I know, it must be easy bt I am new to unix scripting:) Ex. I have file as below and need to e3kbaird and last 2 characters. and than unique records. ... (3 Replies)
Discussion started by: Sanjeev Yadav
3 Replies

5. Shell Programming and Scripting

finding junk characters

Hi, Is there anyway to find the junk characters in a file.Consider the file has data as given below: 123|abc^M|Doctor^C #record 1 234|def|Med #record 2 345|dfg^C|Wrong^V #record 3 The junk characters are highlighted and this is a pipe delimited file. Is there anyway to... (20 Replies)
Discussion started by: ashwin3086
20 Replies

6. UNIX for Dummies Questions & Answers

Unix command to count the number of files with specific characters in name

Hey all, I'm looking for a command that will search a directory (and all subdirectories) and give me a file count for the number of files that contain specific characters within its filename. e.g. I want to find the number of files that contain "-a.jpg" in their name. All the searching I've... (6 Replies)
Discussion started by: murphysm
6 Replies

7. Shell Programming and Scripting

finding characters with new line

I have a file sample.txt with the below contents: Aaa - providioning add || dev - reeec dev kapl || ball - HERO || bal - provisioning pro || for given name i need the output to be the contents between - and || (excluding both) for eg : input - Aaa output -... (10 Replies)
Discussion started by: kinny
10 Replies

8. Shell Programming and Scripting

replacing a nul field with text

Ok here's my pickle. I have a file in which every line must be the same length. Each field within the line is a certain length. None of these can be changed. What I need to do is look at a specific field within this file, let's say it starts with character 30 and ends with 50. If this field is... (3 Replies)
Discussion started by: DarkHound
3 Replies

9. UNIX for Dummies Questions & Answers

finding exact characters

I want to grep from a file an exact character match. I tried grep -c "$a $b" $file where a=6 and b=2 the problem is that I get: 6 2 and 6 20 I just need a count of the occurrence. I'm using the Bourne shell. I've also tried grep -c '$a $b' $file; not sure how to do this - any suggestions? (3 Replies)
Discussion started by: jrdnoland1
3 Replies
Login or Register to Ask a Question