null or other char validation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting null or other char validation
# 1  
Old 10-12-2006
null or other char validation

I have function based out of parameter in file as below

Code:
Getheaderline()
{
v_file='ls -lrt | grep -v "^d" | awk '{print $9}'| grep -v "^$"`
export v_file
cd $DATDIR
PCDIR=`pwd`
echo "current directory = "$PCDIR
line1=`sed '1q' $v_file`
v_col1=`echo $line1 | awk -F"," '{print $1}'`
v_col2=`echo $line1 | awk -F"," '{print $2}'`
v_col3=`echo $line1 | awk -F"," '{print $3}'`
}

There is chances the V_col1 , V_col2 , v_col3 would get NUll or funky character(if Excel ftp to unix in ascii mode).

Can anyone suggest what kind of piece of code incorported here to avoid such validation.
# 2  
Old 10-12-2006
I don't see any validations above. They are simply extracting and assigning...
Please explain in details what you want to do.
# 3  
Old 10-12-2006
I need to validate the variable with Null or funky char that normally came while FTP and file in other mode like ^M, ~,% type

so could you please explain what would be portion and where adjectly should be this keept in the code
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Programming

Invalid conversion from char* to char

Pointers are seeming to get the best of me and I get that error in my program. Here is the code #include <stdio.h> #include <stdlib.h> #include <string.h> #define REPORTHEADING1 " Employee Pay Hours Gross Tax Net\n" #define REPORTHEADING2 " Name ... (1 Reply)
Discussion started by: Plum
1 Replies

2. Shell Programming and Scripting

To find char field and replace null

hi, i having a file with | seperated in which i need to search char in 3rd column and replace with null. i need to replace only the coulmn where character occurs in 3rd field for eg: file1.txt xx|yy|xx|12 output file: xx|yy||12 (5 Replies)
Discussion started by: rohit_shinez
5 Replies

3. Shell Programming and Scripting

To search null and char in file

Hi guys, I want to know how i can search null value and character value in a feed file. my file has Pipe delimted records. for eg: 1|12|xxx|yyy . . . N records I know the the which column null and char occurs does it has for eg 3rd column which i can obtain by awk $3 and (7 Replies)
Discussion started by: rohit_shinez
7 Replies

4. Programming

error: invalid conversion from ‘const char*’ to ‘char*’

Compiling xpp (The X Printing Panel) on SL6 (RHEL6 essentially): xpp.cxx: In constructor ‘printFiles::printFiles(int, char**, int&)’: xpp.cxx:200: error: invalid conversion from ‘const char*’ to ‘char*’ The same error with all c++ constructors - gcc 4.4.4. If anyone can throw any light on... (8 Replies)
Discussion started by: GSO
8 Replies

5. UNIX for Dummies Questions & Answers

/dev/null 2>&1 Versus /dev/null 2>1

How are these two different? They both prevent output and error from being displayed. I don't see the use of the "&" echo "hello" > /dev/null 2>&1 echo "hello" > /dev/null 2>1 (3 Replies)
Discussion started by: glev2005
3 Replies

6. Shell Programming and Scripting

Insert string 'NULL' where there is a null value

I have an input file having 7 fields delimited by , eg : 1,ABC,hg,1,2,34,3 2,hj,YU,2,3,4, 3,JU,kl,4,5,7, 4,JK,KJ,3,56,4,5 The seventh field here in some lines is empty, whereas the other lines there is a value. How do I insert string NULL at this location (7th loc) for these lines where... (8 Replies)
Discussion started by: zilch
8 Replies

7. Programming

concat const char * with char *

hello everybody! i have aproblem! i dont know how to concatenate const char* with char const char *buffer; char *b; sprintf(b,"result.txt"); strcat(buffer,b); thanx in advance (4 Replies)
Discussion started by: nicos
4 Replies

8. Programming

Adding a single char to a char pointer.

Hello, I'm trying to write a method which will return the extension of a file given the file's name, e.g. test.txt should return txt. I'm using C so am limited to char pointers and arrays. Here is the code as I have it: char* getext(char *file) { char *extension; int i, j;... (5 Replies)
Discussion started by: pallak7
5 Replies

9. Shell Programming and Scripting

How to replace any char with newline char.

Hi, How to replace any character in a file with a newline character using sed .. Ex: To replace ',' with newline Input: abcd,efgh,ijkl,mnop Output: abcd efgh ijkl mnop Thnx in advance. Regards, Sasidhar (5 Replies)
Discussion started by: mightysam
5 Replies

10. Shell Programming and Scripting

compare null with non-null

I've got a very peculiar situation. I'm trying to find out if we can compare null fields with non-null. I've output csv files from SQL and Oracle. I need to compare each field from the files, and then find out any differences. The files usualy have over 500 fields, and send the resule to DBA.... (8 Replies)
Discussion started by: nitin
8 Replies
Login or Register to Ask a Question