Datatype file validation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Datatype file validation
# 1  
Old 06-10-2013
Datatype file validation

Code:
 
I have a sourcefile which contains data as below.I want to check whether datatype,structure and date format looks good as mentioned. 
Data is delemited by cydila  .
 
Source file-Emp.txt
sno name   phoneno  dept joineddate
1   vivek  0861     CSE  2013-05-29 00:00:00
2   dinesh 123456   ECE  2013-05-29 00:00:00
3   sai    78945    EEE  2013-05-29 00:00:00
4   sridar 45612    IT   2013-05-29 00:00:00
 
Defination of emp.txt file.
column name datatype format
sno number(2)
name varchar(20)
phoneno number(10)
dept varchar(20)
joineddate date yyyy-mm-dd hh:mm:ss
 
Please suggest me which command should use to check whether datatype,structure and date format is correct.

# 2  
Old 06-10-2013
# 3  
Old 06-10-2013
sourec file EMP.txt

snoÇnameÇphonenoÇdeptÇjoineddate
1ÇvivekÇ0861ÇCSEÇ2013-05-29 00:00:00
2ÇdineshÇ123456ÇECEÇ2013-05-29 00:00:00
3ÇsaiÇ78945ÇEEEÇ2013-05-29 00:00:00
4ÇsridarÇadfÇITÇ2013-05-29 00:00:00


log file
err 1ÇvivekÇ0861ÇCSEÇ2013-05-29 00:00:00-this should be fine not sure why getting error.
ok 2ÇdineshÇ123456ÇECEÇ2013-05-29 00:00:00
ok 3ÇsaiÇ78945ÇEEEÇ2013-05-29 00:00:00
ok 4ÇsridarÇadfÇITÇ2013-05-29 00:00:00-Third column should be number but it is varchar not sure why it is not throwing error.

Please suggest me.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Datatype,structure and dateformat checking.

I have a sourcefile which contains data as below.I want to check whether datatype,structure and date format looks good as mentioned. Data is delemited by cydila Ç. Source file-Emp.txt snoÇnameÇphonenoÇdeptÇjoineddate 1ÇvivekÇ0861ÇCSEÇ2013-05-29 00:00:00 2ÇdineshÇ123456ÇECEÇ2013-05-29 00:00:00... (8 Replies)
Discussion started by: katakamvivek
8 Replies

2. Shell Programming and Scripting

Datatype and length validation

I have sourcefile and structure of source file,i want to check whether datatype and length mention in emp.txt is same as source file. Example: in emp.txt first row contains sno number so in source file also first column should contain only number if data is other than number then that... (1 Reply)
Discussion started by: katakamvivek
1 Replies

3. Programming

Understanding C++ template partial specialization with pointer datatype arguments

When I compile the below code, I am getting error as template<typename T> T AddFun(T i, T j) { return i + j; } template<> T* AddFun<T*>(T* i, T* j) { return new T(*i + *j); } int main() { int n = AddFun<int>(10, 20); int i = 10, j = 20; int* p = AddFun<int*>(&i,... (1 Reply)
Discussion started by: royalibrahim
1 Replies

4. Shell Programming and Scripting

File validation

Hi there, As a part of file validation, I needed to check for delimiter count in the file. My aim is to find, how many records have failed to have predefined numbers of delimiters in the file. My code looks like below i=`awk -F '|' 'NF != 2 {print NR, $0} ' ${pinb_fldr}/${pfile}DAT |... (3 Replies)
Discussion started by: anandapani
3 Replies

5. Shell Programming and Scripting

Help with separating datatype, column name

Hi All, I am new to unix but have a requirement wherein I need to separate datatype,length, and column name from input file which is of below format -- record integer(10) empid; string(25) name; date("YYYY-MM-DD") dob; decimal(10) salary; end now after getting datatype,its length and... (4 Replies)
Discussion started by: phoenix09
4 Replies

6. Shell Programming and Scripting

XML file validation

Hi, i am new to unix script. i have two xml files. one is orderinfo.xml and another one is xsd file(EmailMessage.xml). we need to compare the both file for poper nodes exists are not. for example: <xsd:element name="EmailMessage"> tag in the EmailMessage.xml file(xsd sheet),this tag... (2 Replies)
Discussion started by: bmk
2 Replies

7. Shell Programming and Scripting

File validation

Hello, File contains 1,3 and 5 are required columns. it's working use this command. awk -F\| '$1 && $3 && $5' test1.txt > test2.txt How can use this unix programming.while using runnign this scirpt,it's raising the error. awk: ^ syntax error #!/usr/bin/ksh `awk -F\| '$1 &&... (3 Replies)
Discussion started by: bammidi
3 Replies

8. Shell Programming and Scripting

File Name Validation

Hi All, I am trying to validate the file name against the naming convention mentioned in configuration file. In the configuration file, the file name convention is mentioned as: Myfile_SQ<NN>_<NN>_YYYYMMDD_HHMMSS.xml The actual file received is Myfile_SQ10_30_20110423_073002.xml How do... (1 Reply)
Discussion started by: angshuman
1 Replies

9. Programming

How to get the size of the datatype passed as the command line argumet?

#include <stdio.h> int main(int argc, char *argv) { printf("%d\n", sizeof(argv)); return 0; } when I run the executable a.out after compiling the above program as: a.out short (or) a.out "long double", I expected to get the output as 2 and 12, but I am always getting the size of... (2 Replies)
Discussion started by: royalibrahim
2 Replies

10. UNIX for Dummies Questions & Answers

File Validation

Hi All, I am new to UNIX scripting. I need to validate a file. I need to check whether the file has a header , detail records and footer. If all the file is good I need to create a status file with the status 'Y' else 'N'. I have pasted the an example of the file below: ... (5 Replies)
Discussion started by: kumar66
5 Replies
Login or Register to Ask a Question