Sponsored Content
Top Forums Shell Programming and Scripting Help to retrieve data from two files matching a string Post 302558186 by shaliniyadav on Friday 23rd of September 2011 04:14:53 AM
Old 09-23-2011
Java Help to retrieve data from two files matching a string

Hello Experts,

I have come back to this forum after a while now, since require a better way to get my result.. My query is as below..

I have 3 files -- 1 Input file, 2 Data files .. Based on the input file, data has to be retreived matching from two files which has one common key..
For EX:

Input file

Code:
 
919868191075
919868191028

Data File1

Code:
 
 
subsD,00 0A 02 48 4A 6B 92 01 58 06 5E 00,hlr,common,404686600492447,919868191075,919868191075,00000000,FALSE,FALSE,3,10,11|
subsD,01 40 46 85 50 47 15 87 40 00 00 00,hlr,common,404685504715874,919868191008,919868191008,00000000,FALSE,FALSE,1,10,11|
subsD,01 40 46 86 60 04 72 06 80 00 00 00,hlr,common,404686600473790,919868191085,919868191085,00000000,FALSE,FALSE,1,10,11|
subsD,00 0A 01 4A FB A6 C4 01 CD 0E 9A 00,hlr,common,404685505866829,919868191028,919868191028,00000000,FALSE,FALSE,6,10,11|

Data file2

Code:
imsiD,404686600667311,,7F0413BE=subsD|70400F2=00 0A 02 48 4A 6B 92 01 58 06 5E 00
imsiD,404686600369463,,7F0413BE=subsD|70400F2=01 40 46 85 50 47 15 87 40 00 00 00
imsiD,404685507343909,,7F0413BE=subsD|70400F2=01 40 46 86 60 04 72 06 80 00 00 00
imsiD,404685504666094,,7F0413BE=subsD|70400F2=01 40 46 85 50 46 66 09 40 00 00 00
imsiD,404686600708986,,7F0413BE=subsD|70400F2=00 0A 01 4A FB A6 C4 01 CD 0E 9A 00

Output should be like

Code:
 
Number Data1 Data2
919868191075 000A02484A6B920158065E00 404686600667311
919868191028 000A014AFBA6C401CD0E9A00 404686600708986

First column is the string from input file(919868191075) , next is the 2nd field in CSV file1 matching string in 6th field(000A02484A6B920158065E00 ), last one is 2nd field in csv file2 here matching string would be output retreived from first file(404686600667311
)...

Thanks in advance.. Looking forward for your help...
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Retrieve data from a file

Hello guys I want to retrieve two data from a file, like this: bash-2.03$ cat numtest 123456 123457 bash-2.03$ more ./test_num #!/bin/bash num1= num2= cnt=1 while read x do num${cnt}=$x cnt=$(($cnt+1)) done <$1 echo $num1 "\n" $num2 But when i executed this script, error... (2 Replies)
Discussion started by: tpltp
2 Replies

2. Shell Programming and Scripting

matching string in two files of different length

Dear all, I have the following problem (it originates in the domain of bio-inf, but it is a general problem). I have two files of one column each and of different length: a.txt and b.txt. a.txt contains alphanumeric strings (around 30 digit) and there are 300 rows b.txt contains alphanumeric... (2 Replies)
Discussion started by: ad_meis
2 Replies

3. Programming

How to find the matching data b/w 2 files in perl?

Hi friends,, i have find the matching data between 2files. My file1 have a data like rs3001336 rs3984736 rs2840532 File2 have a data like rs3736330 1 2359237 A G 0.28 1.099 0.010 rs2840532 1 2359977 G A 0.363 0.3373 1.123 rs3001336 1 2365193 G A 0.0812 0.07319 1.12 ... (1 Reply)
Discussion started by: sureshraj
1 Replies

4. Shell Programming and Scripting

How to find the matching data b/w 2 files in perl?

Hi friends,, i have find the matching data between 2files. My file1 have a data like rs3001336 rs3984736 rs2840532 File2 have a data like rs3736330 1 2359237 A G 0.28 1.099 0.010 rs2840532 1 2359977 G A 0.363 0.3373 1.123 rs3001336 1 ... (4 Replies)
Discussion started by: sureshraj
4 Replies

5. Shell Programming and Scripting

search string in a file and retrieve 10 lines including string line

Hi Guys, I am trying to write a perl script to search a string "Name" in the file "FILE" and also want to create a new file and push the searched string Name line along with 10 lines following the same. can anyone of you please let me know how to go about it ? (8 Replies)
Discussion started by: sukrish
8 Replies

6. Shell Programming and Scripting

Matching string on two files based on match rules.

Hi, How to check if a string on file2 exactly matches with a part or complete string on file1, and return a match indicator based on some match rules. 1) only records on file1 with category A should be matched. for other category, the output match indicator should default to 'N' 2) on file2... (13 Replies)
Discussion started by: effay
13 Replies

7. Shell Programming and Scripting

Compare two files and get matching data

Hi, Can anyone help me to compare two files and get the matching data... say i have file1 and file2 ... file1 has 300 unique data with that i need to match with file2 to see how may are matching.. file2 have 1000 records. (4 Replies)
Discussion started by: zooby
4 Replies

8. Shell Programming and Scripting

Compare columns of two files and retrieve data

Hi guys, I need your help. I have two files: file1 1 3 5 file2 1,XX 2,AA 3,BB 4,CC 5,DD I would like to compare the first column and where they are equal to write that output in a new file: 1,XX 3,BB (7 Replies)
Discussion started by: apenkov
7 Replies

9. Shell Programming and Scripting

How can I retrieve the matching records from data file mentioned?

XYZNA0000778800Z 16123000012300321000000008000000000000000 16124000012300322000000007000000000000000 17234000012300323000000005000000000000000 17345000012300324000000004000000000000000 17456000012300325000000003000000000000000 9 XYZNA0000778900Z 16123000012300321000000008000000000000000... (8 Replies)
Discussion started by: later_troy
8 Replies

10. Shell Programming and Scripting

Field matching in two data files

Hello, I am looking to output all of the lines from file2 whose 11th field is present in the first field in file1. Then the second field from file1 should be appended as such: file1: 2222 0.35 4444 0.25 5555 0.75 file2: col1 col2 col3 col4 col5 col6 col7 col8 col9 col10 1111 col1 col2... (4 Replies)
Discussion started by: palex
4 Replies
gtk-query-immodules-2.0(1)					   User Commands					gtk-query-immodules-2.0(1)

NAME
gtk-query-immodules-2.0 - create a cache file used by GTK+ to efficiently locate input method modules SYNOPSIS
gtk-query-immodules-2.0 [immodule] [immodule...] DESCRIPTION
gtk-query-immodules-2.0 searches for input method (IM) modules and creates a cache file that will be used by the GTK+ library to effi- ciently locate these files. This program is typically used by developers who are packaging GTK+ software. IM modules can be selected by right-clicking on input fields when running GTK+ programs. An input method is a software component that con- verts key presses into text input that cannot be typed directly. Input methods are normally used to input text for languages that have more characters than can fit on a standard keyboard. Input methods are commonly used for Japanese, Chinese, and Korean text but are also used for other languages such as Thai and Hindi. If any modules are specified on the command line, gtk-query-immodules-2.0 only looks at those particular files. If no modules are specified on the command line, gtk-query-immodules-2.0 scans the user's GTK_PATH environment variable and looks at all IM modules that are specified there. When run, gtk-query-immodules-2.0 creates context information for each module. Each module has one or more contexts. If no IM modules are specified on the command line, the scanned paths are included as a comment in the output. OPTIONS
None. OPERANDS
The following operands are supported: immodule Specify the pathname to an IM module. This can be a full pathname, or relative to the current working directory. EXAMPLES
Example 1: Installing a New Input Method Module example% binary_version=`pkg-config --variable=gtk_binary_version gtk-2.0` example% cp myimmodule.so $prefix/lib/gtk-2.0/$binary_version/immodules example% gtk-query-immodules-2.0 > $sysconfdir/gtk-2.0/gtk.immodules The values for the $prefix and $sysconfdir variables depend on how GTK+ was installed. In a standard systemwide installation of GTK+, these values are /usr and /etc respectively. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of gtk-query-immodules-2.0: GTK_PATH Specifies what directories contain IM modules. GTK_IM_MODULE Specifies what IM modules to use, in preference to the IM module determined from the locale GTK_IM_MODULE_FILE Specifies the file that lists the IM modules to load. This environment variable overrides the im_module_file speci- fied in the RC files, which in turn overrides the default value in the system gtk.immodules file. EXIT STATUS
The following exit values are returned: 0 Application exited successfully >0 Application exited with failure FILES
The following files are used by this application: /usr/bin/gtk-query-immodThescommand-line executable for the application. /etc/gtk-2.0/gtk.immodulThe GTK+ input method modules file. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWgnome-base-libs-devel | +-----------------------------+-----------------------------+ |Interface stability |Evolving | +-----------------------------+-----------------------------+ SEE ALSO
libgtk-x11-2.0(3) NOTES
Written by Brian Cameron, Sun Microsystems Inc., 2003. SunOS 5.10 2 Apr 2003 gtk-query-immodules-2.0(1)
All times are GMT -4. The time now is 12:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy