Sponsored Content
Top Forums Shell Programming and Scripting File comparison of different format Post 302598093 by rajniman on Monday 13th of February 2012 10:39:13 AM
Old 02-13-2012
Hi franklin52,

its only working for this eg. but not for my database of 80000
As you have used here ":" as feild seperator. but column 2 of fileD can be present anywhere before or after of any symbols . i will like to give my files as

fileB :
Code:
 

02.09.2011:MOU04/KUBIS--R_Lieferung_1/KUBIS_V15.0/vpn_wls_15-0-0b01
02.09.2011:MOU04/KUBIS--R_Lieferung_2/KUBIS_V15.0/apng_wls_15-0-0b02
31  02.09.2011:MOU04/KUBIS--R_Lieferung_2/KUBIS_V15.0/ecc_wls_15-0-0b02
32  02.11.2010:PPMOU/VOMS--VOMS-ASR3244/VoMS2.3.0_LieferungZu_AO-Order004385
33  02.11.2010:PPMOU/PRMKONF-RBO-01.00.13.00/XXX_mandatory_LieferungZu_AO-Order004513
33  02.11.2010:PROD/PRMKONF-RBO-01.00.13.00/XXX_mandatory_LieferungZu_AO-Order004513
34  02.11.2011:WOMS2/KUBIS--S_Lieferung_1/KUBIS_V16.0/kubis_db_16-0-0b01
02.11.2011:WOMS2/KUBIS--S_Lieferung_2/KUBIS_V16.0/kubis_db_16-0-0b02
36  02.11.2011:WOMS2/KUBIS--TS-InTime-VV/Lieferung_WoM_Maxx_VV_01_20111026
37  02.11.2011:WOMS2/PA--PA-MaxX-Konf/PA-MaxX-Konf-01.00.00.00
38  02.11.2011:WOMS2/PM--PM-5.0/PRM-LIB-05.00.00.00
39  02.11.2011:WOMS2/PM--PM-MaxX-Konf/PRMKONF-MaxX-01.00.00.00
40  02.11.2011:WOMS2/SALES--SK-Tools-2.0.0_Lieferung_01_20111024/SK-Tools-2.0/database-dist_2-0-0b01
41  02.11.2011:WOMS2/SALES--SK-Tools-2.0.0_Lieferung_01_20111024/SK-Tools-2.0/salescomponent-dist_2-0-0b01
42  02.12.2010:PPMOU/VOMS--AO-intern_RU10_VOMS_ASR3605/XXX_mandatory_LieferungZu_AO-Order004638

this is not a csv file or it does not contain any seperator. its just a file.

and my fileD is as follows
Code:
PRMKONF-RBO-01.00.13.00          PROD
REL_001.630.008_LieferungZu_AO-Order004266      PROD
CASS-CR099-1-2T         PPMOU
CASS-CR099-1-2T         PROD

this is a csv file . so now i want to compare this file first value of fileD ie "PRMKONF-RBO-01.00.13.00" in fileB. now if it is found in fileB whole line is copied and checked for second column of "PRMKONF-RBO-01.00.13.00" if this second column is present in that line or not. ie second column is PROD . so if this PROD is present in that line than it is not redirrected for output. if this is not present in that file then that row from fileD is redirected for output.

so output shall be
Code:
REL_001.630.008_LieferungZu_AO-Order004266      PROD
CASS-CR099-1-2T         PPMOU
CASS-CR099-1-2T         PROD

this PRMKONF-RBO-01.00.13.00 PROD is not outputed as "PRMKONF-RBO-01.00.13.00" is present and that line contains "PROD".
and also PRMKONF-RBO-01.00.13.00 can be present in many lines of fileB and each line should be considered for checking second columns of fileD.as for above example
"PRMKONF-RBO-01.00.13.00" was present in two line as

33 02.11.2010:PPMOU/PRMKONF-RBO-01.00.13.00/XXX_mandatory_LieferungZu_AO-Order004513
33 02.11.2010:PROD/PRMKONF-RBO-01.00.13.00/XXX_mandatory_LieferungZu_AO-Order004513

so PROD will be found in any of this line.

many thanks in advance..
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Convert UTF8 Format file to ANSI format

:) Hi i am trying to convert a file which is in UTF8 format to ANSI format i tried to use the function ICONV but it is throwing error Function i used it as $ iconv -f UTF8 -t ANSI filename Error iam getting is NOT Supported UTF8 to ANSI please some help me out on this.........Let me... (1 Reply)
Discussion started by: rajreddy
1 Replies

2. UNIX for Dummies Questions & Answers

Convert UTF8 Format file to ANSI format

:confused: Hi i am trying to convert a file which is in UTF8 format to ANSI format i tried to use the function ICONV but it is throwing error Function i used it as $ iconv -f UTF8 -t ANSI filename Error iam getting is NOT Supported UTF8 to ANSI please some help me out on... (9 Replies)
Discussion started by: rajreddy
9 Replies

3. UNIX for Dummies Questions & Answers

To convert multi format file to a readable ascii format

Hi I have a file which has ascii , binary, binary decimal coded,decimal & hexadecimal data with lot of special characters (like öƒ.ƒ.„İİ¡Š·œƒ.„İİ¡Š· ) in it. I want to standardize the file into ASCII format & later use that as source . Can any one suggest a way a logic to convert such... (5 Replies)
Discussion started by: gaur.deepti
5 Replies

4. Shell Programming and Scripting

Output format - comparison with I/p file

Hi, I have a file which contains more than 1 lakh records like following: a. name, id, city, state, country, phone (Expected I/P file format) name, id, city,, state, country, phone (Current I/P file format ) I want to achieve following tasks, a, Remove the extra comma in the... (1 Reply)
Discussion started by: velappangs
1 Replies

5. Shell Programming and Scripting

File Comparison

Hi i have 2 csv files a.csv and b.csv with the same number of columns and a list of values in both of it. Each and every individual value in both the files need to compared and if it matches then print correct in a new csv file otherwise print Incorrect eg a.csv 1,12/27/2007,Reward,$10.00... (5 Replies)
Discussion started by: naveenn08
5 Replies

6. UNIX for Dummies Questions & Answers

Convert UNIX file format to PC format

Hi All, Is there any way to convert a file which is in UNIX format to a PC format.... Flip command can be used , apart form this command can we have any other way.... like usinf "awk" etc ..... main purpose of not using flip is that my Kshell doesnot support this comamnd.... (1 Reply)
Discussion started by: Samtel
1 Replies

7. Shell Programming and Scripting

Convert UNIX file format to PC format

Hi All, Is there any way to convert a file which is in UNIX format to a PC format.... Flip command can be used , apart form this command can we have any other way.... like usinf "awk" etc ..... main purpose of not using flip is that my Kshell doesnot support this comamnd.... (2 Replies)
Discussion started by: Samtel
2 Replies

8. Shell Programming and Scripting

Converting windows format file to unix format using script

Hi, I am having couple of files which i used to copy from windows to Linux, so now in case of text files (CTRL^M) appears at end of line. I know i can convert this windows format file to unix format file by running dos2unix. My requirement here is that i want to do it automatically using a... (5 Replies)
Discussion started by: sarbjit
5 Replies

9. Shell Programming and Scripting

File Comparison: Print Lines not present in another file

Hi, I have fileA.txt like this. B01B02 D0011718 B01B03 D0012540 B01B04 D0006145 B01B05 D0004815 B01B06 D0012069 B01B07 D0004064 B01B08 D0011988 B01B09 D0012071 B01B10 D0005596 B01B11 D0011351 B01B12 D0004814 B01C01 D0011804 I want to compare this against another file (fileB.txt)... (3 Replies)
Discussion started by: genehunter
3 Replies

10. Shell Programming and Scripting

Need help to format one txt file to required format

Hello Everyone, I have one source file which is genarated by SAP in different format(Which I've never seen). I need to convert that file to required format and I need to read this target file from Datastage to use this in my Jobs. So I do not have any other options except to use Unix script to... (4 Replies)
Discussion started by: Prathyu
4 Replies
bup-margin(1)						      General Commands Manual						     bup-margin(1)

NAME
bup-margin - figure out your deduplication safety margin SYNOPSIS
bup margin [options...] DESCRIPTION
bup margin iterates through all objects in your bup repository, calculating the largest number of prefix bits shared between any two entries. This number, n, identifies the longest subset of SHA-1 you could use and still encounter a collision between your object ids. For example, one system that was tested had a collection of 11 million objects (70 GB), and bup margin returned 45. That means a 46-bit hash would be sufficient to avoid all collisions among that set of objects; each object in that repository could be uniquely identified by its first 46 bits. The number of bits needed seems to increase by about 1 or 2 for every doubling of the number of objects. Since SHA-1 hashes have 160 bits, that leaves 115 bits of margin. Of course, because SHA-1 hashes are essentially random, it's theoretically possible to use many more bits with far fewer objects. If you're paranoid about the possibility of SHA-1 collisions, you can monitor your repository by running bup margin occasionally to see if you're getting dangerously close to 160 bits. OPTIONS
--predict Guess the offset into each index file where a particular object will appear, and report the maximum deviation of the correct answer from the guess. This is potentially useful for tuning an interpolation search algorithm. --ignore-midx don't use .midx files, use only .idx files. This is only really useful when used with --predict. EXAMPLE
$ bup margin Reading indexes: 100.00% (1612581/1612581), done. 40 40 matching prefix bits 1.94 bits per doubling 120 bits (61.86 doublings) remaining 4.19338e+18 times larger is possible Everyone on earth could have 625878182 data sets like yours, all in one repository, and we would expect 1 object collision. $ bup margin --predict PackIdxList: using 1 index. Reading indexes: 100.00% (1612581/1612581), done. 915 of 1612581 (0.057%) SEE ALSO
bup-midx(1), bup-save(1) BUP
Part of the bup(1) suite. AUTHORS
Avery Pennarun <apenwarr@gmail.com>. Bup unknown- bup-margin(1)
All times are GMT -4. The time now is 10:26 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy