include NULLs in line length check


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting include NULLs in line length check
# 8  
Old 06-30-2009
uploaded example of input. You can see NULL values in TextPad editor. Don't use in notepad and wordpad - they show up as spaces. In UNIX vi - the values are ignored.
# 9  
Old 06-30-2009
just realized one of my lines I edited was long. re-attached
# 10  
Old 06-30-2009
I decided to strip out the NULLs and replace with spaces. I could not get tr to work either. Maybe an issue with Solaris??
Below perl code worked though:

perl -pe 's/\000/ /g' file > newfile

Thanks for help. It would still be nice to know if my original question could be solved.
# 11  
Old 06-30-2009
You can write a small C program to do this or use tr...
Code:
tr -d "\000" <file

Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Check for length which exceeds specified length in a line

Hi, I have a issue, I need to loop through a comma delimited file and check for the length which exceeds specified length , if Yes truncate the string. But my problem is , I do not have to check for all the fields and the field lenght is not same for all the fields. For ex: Say my line... (9 Replies)
Discussion started by: rashmisb
9 Replies

2. Shell Programming and Scripting

perl file, one line code include "length, rindex, substr", slow

Hi Everyone, # cat a.txt a;b;c;64O a;b;c;d;ee;f # cat a.pl #!/usr/bin/perl use strict; use warnings; my $tmp3 = ",,a,,b,,c,,d,,e,,f,,"; open(my $FA, "a.txt") or die "$!"; while(<$FA>) { chomp; my @tmp=split(/\;/, $_); if ( ($tmp =~ m/^(64O)/i) || ($tmp... (3 Replies)
Discussion started by: jimmy_y
3 Replies

3. Shell Programming and Scripting

Check length of record

Hi, I have a problem, please help me, I have a flat file like this: P00000000088888888999999999 0000999903 000000000000000000 P00000000077777777000000000 0000999903 000000000000000000 P00000000044444444333333333 0000999903 00000000000000000079875 P00000000066666666111111111 0000999903 ... (5 Replies)
Discussion started by: DebianJ
5 Replies

4. Shell Programming and Scripting

Deleting Characters at specific position in a line if the line is certain length

I've got a file that would have lines similar to: 12345678 x.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 23456781 x.00 xx.00 xx.00 xx.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 34567812 x.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 45678123 x.00 xx.00 xx.00 xx.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 xx.00... (10 Replies)
Discussion started by: Cailet
10 Replies

5. Shell Programming and Scripting

sort truncates line when they contain nulls

When I try to sort a file where some records contain nulls i.e. hex 00 the sort truncates the record when it reaches the null and writes message: "sort: warning: missing NEWLINE added at end of input file myfile" I'm assuming from this that the sort sees the null as a special character and... (6 Replies)
Discussion started by: ArthurWaik
6 Replies

6. Shell Programming and Scripting

How to check Null values in a file column by column if columns are Not NULLs

Hi All, I have a table with 10 columns. Some columns(2nd,4th,5th,7th,8th and 10th) are Not Null columns. I'll get a tab-delimited file and want to check col by col and generate seperate error code for each col eg:102 if 2nd col value is NULL and 104 if 4th col value is NULL so on... I am a... (7 Replies)
Discussion started by: Mandab
7 Replies

7. AIX

check length

I'm not familiar with unix. I need know how to check parameter (length) when i need check the userid. lets say my charaters is 3, how to check I must key-in 3 word before system can continue to another step echo "\n\n\n\tPlease Enter User ID: \c" read userid if then echo... (1 Reply)
Discussion started by: wanasmadi
1 Replies

8. Shell Programming and Scripting

Check length of Shell Variable

I am using a Korn Shell script.. I need to verify the length of a variable.. ie number=12345 I need then to check 12345 to make sure its no longer than 5 digits... Can you help? (4 Replies)
Discussion started by: frustrated1
4 Replies
Login or Register to Ask a Question