Datatype and length validation


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Datatype and length validation
# 1  
Old 06-13-2013
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 particular row in source file should mention as error in log file.

Source file
Code:
snoÇnameÇphonenoÇdeptÇjoineddate
1.ÇvivekÇ0861ÇCSEÇ2013-05-29 00:00:00
2ÇdineshÇ1234.56ÇECEÇ2013-05-29 00:00:00
3ÇsaiÇ568ÇÇ2013-05-29 00:00:00
4ÇsridarÇ123ÇITÇ2013-05-29 00:00:00

emp.txt(Source file structure)
Code:
sno number(10)
name varchar(20)
phone number(10)
dept varchar(10)
joindate date(10)


Last edited by Franklin52; 06-13-2013 at 03:16 AM.. Reason: Fixed code tags
# 2  
Old 06-13-2013
Why not use post you already have:
https://www.unix.com/shell-programmin...-checking.html
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Length validation

I am using below code to find the length of first column additionally I want the complete row which length is greater than 12.at the end I want the rows where first column data length is greater than 12. Just it should validate and highlight the rows where length(first column) is greater than... (5 Replies)
Discussion started by: srivalli
5 Replies

2. 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

3. Shell Programming and Scripting

Datatype file validation

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 ... (2 Replies)
Discussion started by: katakamvivek
2 Replies

4. 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

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

Flat file-make field length equal to header length

Hello Everyone, I am stuck with one issue while working on abstract flat file which i have to use as input and load data to table. Input Data- ------ ------------------------ ---- ----------------- WFI001 Xxxxxx Control Work Item A Number of Records ------ ------------------------... (5 Replies)
Discussion started by: sonali.s.more
5 Replies

7. 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

8. Shell Programming and Scripting

AWK - Line length validation

Hi, I have requirement where record length is stored in an variable RECORD_LENGTH Code goes as follows RECORD_LENGTH=537 the above is arrived from #RECORD_LENGTH=`awk -F"=" '{$sum+=$2} END{print $sum}' DBP_Claims_CFG.ini` awk ' { if (length() == '$RECORD_LENGTH') print FNR, $0... (4 Replies)
Discussion started by: ainuddin
4 Replies

9. Shell Programming and Scripting

AWK - Line length validation

I am attempting to use awk to validate the length of each line in a fixed-width raw data file prior to reading in the data. I am happy with.... {if (length() == 403) print > "valid.file"; else print > " invalid.file" } ...to separate out the valid length lines from invalid length... (3 Replies)
Discussion started by: en7smb
3 Replies
Login or Register to Ask a Question