Compare the source definition file with data file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Compare the source definition file with data file
# 1  
Old 02-10-2016
Compare the source definition file with data file

Hi

How to compare the source definition file in unix with the data file .

Please can you share me example if some one has done it before
# 2  
Old 02-10-2016
Hi,

You'll have to be a bit more specific here, compare what file with what file?

There are a number of utilities for file comparison in unix, so an example of what you require would help.

Regards

Gull04
# 3  
Old 02-10-2016
Hi Gull

I have a requirement to validate the data in the txt file based on the source definition file.
I have a data file emp.txt and source definition file emp_src_def.dat with the definition of the data types , length and not null constraint. how do I compare the the both files using a shell script

emp.txt:
Code:
H|INV001|20|10-MAY-2015|invoice1 created
H|INV002|30|19-MAY-2015|invoice2 created
L|690845|INV001|LINE|1|10|travel expense for emp102
L|690846|INV001|LINE|2|10|dinner expense
L|690847|INV002|LINE|1|30|travel expense for emp238
T|000005|2|3|50

source_def_emp.dat:
Code:
H|CHAR(5)|NUMBER|DATE (DD-MON-YYYY)|CHAR(100)
L|NUMBER NOTNULL|CHAR(5)|CHAR(5)|NUMBER|NUMBER|CHAR(100)

Regards
Raj

Last edited by Don Cragun; 02-10-2016 at 08:49 PM.. Reason: Add CODE and ICODE tags.
# 4  
Old 02-10-2016
Moderator's Comments:
Mod Comment This thread has been moved to a technical forum from an administrative forum.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare data with reference from other file

Gents, Please can you help with this. I have a big file (file2) which contends many records increment every 25 rows ( column 1 ). Then I have other file as reference (file1).. column 1 to 11. I want to compare that all values in file2 (column 2 to 12.) match with values in... (2 Replies)
Discussion started by: jiam912
2 Replies

2. Shell Programming and Scripting

Compare 2 files of csv file and match column data and create a new csv file of them

Hi, I am newbie in shell script. I need your help to solve my problem. Firstly, I have 2 files of csv and i want to compare of the contents then the output will be written in a new csv file. File1: SourceFile,DateTimeOriginal /home/intannf/foto/IMG_0713.JPG,2015:02:17 11:14:07... (8 Replies)
Discussion started by: refrain
8 Replies

3. Shell Programming and Scripting

Compare 2 text file with 1 column in each file and write mismatch data to 3rd file

Hi, I need to compare 2 text files with around 60000 rows and 1 column. I need to compare these and write the mismatch data to 3rd file. File1 - file2 = file3 wc -l file1.txt 58112 wc -l file2.txt 55260 head -5 file1.txt 101214200123 101214700300 101250030067 101214100500... (10 Replies)
Discussion started by: Divya Nochiyil
10 Replies

4. UNIX for Dummies Questions & Answers

Mapping a data in a file and delete line in source file if data does not exist.

Hi Guys, Please help me with my problem here: I have a source file: 1212 23232 343434 ASAS1 4 3212 23232 343434 ASAS2 4 3234 23232 343434 QWQW1 4 1134 23232 343434 QWQW2 4 3212 23232 343434 QWQW3 4 and a mapping... (4 Replies)
Discussion started by: kokoro
4 Replies

5. Shell Programming and Scripting

Redirect output to a different text file depending source of data

I have a list of DNS servers I need to look up information on. Each of these servers has a master and a slave database. Essentially what I need to do is create two text files for each server. One with the Master view and one with the Slave view. There's 20 servers, in the end I should have 40 text... (4 Replies)
Discussion started by: spartan22
4 Replies

6. Shell Programming and Scripting

Compare a file with all others then print off data

my script so far nawk -F, 'NR==FNR{a++;next} a{b++} END{for(i in b){if(b-1){print i";\t\t"b}else{print "NEW:"i";\t\t1"} } }' OFS=, 20111228.csv *.csv | sort NE:221478,SHELF:13,SLOT:4; 2 NE:221726,SHELF:8,SLOT:1; 2 NE:222318,SHELF:14,SLOT:1; 9... (20 Replies)
Discussion started by: llcooljatt
20 Replies

7. Shell Programming and Scripting

help to compare data from file using shell script to c++ program

hello ....i am new in shell script..I have one shell script which read inputs from file...and second is c++ pgm..i call my script from c++ programm..to compare file values to c++ pgm value.. our shell script is shubhi.sh #! /bin/sh while read line do echo -e"$line" done<file1 this script... (1 Reply)
Discussion started by: shubhig15
1 Replies

8. Shell Programming and Scripting

Compare and print out data only appear in file 1 problem

Below is the data content of file_1 and file_2: file_1 >sample_1 FKGJGPOPOPOQA ASDADWEEWERE ASDAWEWQWRW ASDASDASDASDD file_2 >sample_1 DRTOWPFPOPOQA ASDADWEEASDF ASDADRTYWRW ASDASDASDASDD I got try the following perl script. Unfortunately, it can't give my desired output result... (7 Replies)
Discussion started by: patrick87
7 Replies

9. Shell Programming and Scripting

Post Shell programming: Question about source a file and read data from the file

This is shell programming assignment. It needs to create a file called .std_dbrc contains STD_DBROOT=${HOME}/class/2031/Assgn3/STD_DB (which includes all my simple database files) and I am gonna use this .std_dbrc in my script file (read the data from the database files) like this: .... (3 Replies)
Discussion started by: ccwq
3 Replies

10. UNIX for Dummies Questions & Answers

Compare Data in the same file

Dear Unix-Gurus, I'm trying to write a script to compare the data in a log file. Here's how my logfile will look like: 'List All A0 Data in Destination Server' A0567 A0678 A0789 List A0 Files in Source Server A0567 A0678 A0789 So if the file match in Source Server match Destination... (1 Reply)
Discussion started by: lweegp
1 Replies
Login or Register to Ask a Question