Sponsored Content
Top Forums Shell Programming and Scripting Common records after matching on different columns Post 302597235 by jacobs.smith on Thursday 9th of February 2012 05:08:20 PM
Old 02-09-2012
Thanks to both of you for leading me in some way or the other.

The shell script produces the following output.

opfromshell.txt
Quote:
chr1 300 400 1.txt
chr1 350 467 1.txt
But, I was looking for

Originaloutput.txt
Quote:
chr1 300 400 1.txt
chr1 350 467 1.txt
chr1 201 299 2.txt
chr2 800 1000 2.txt
chr2 100 200 2.txt
chr3 500 600 2.txt
Please, no offense. Since the earlier replies in that post worked, I didn't want to bother Shell_life.

Any help is highly appreciated.

Thanks in advance.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Common records using AWK

Hi, To be honest, I am really impressed and amazed at the pace I find solutions for un-solved coding mysteries in this forum. I have a file like this input1.txt x y z 1 2 3 a b c 4 -3 7 k l m n 0 p 1 2 a b c 4 input2 x y z 9 0 -1 a b c 0 6 9 k l m 8 o p 1 2 a f x 9 Output... (9 Replies)
Discussion started by: jacobs.smith
9 Replies

2. Shell Programming and Scripting

Matching and Merging csv data fields based on a common field

Dear List, I have a file of csv data which has a different line per compliance check per host. I do not want any omissions from this csv data file which looks like this: date,hostname,status,color,check 02-03-2012,COMP1,FAIL,Yellow,auth_pass_change... (3 Replies)
Discussion started by: landossa
3 Replies

3. Shell Programming and Scripting

Common records

Hi, I have the following files, A M 2 3 B E 4 5 C I 5 6 D O 4 5 A M 3 4 B E 5 2 F U 7 9 J K 2 3 OUTPUT A M 2 3 3 4 B E 4 5 5 2 thanks in advance, (7 Replies)
Discussion started by: jacobs.smith
7 Replies

4. UNIX for Dummies Questions & Answers

keeping last record among group of records with common fields (awk)

input: ref.1;rack.1;1 #group1 ref.1;rack.1;2 #group1 ref.1;rack.2;1 #group2 ref.2;rack.3;1 #group3 ref.2;rack.3;2 #group3 ref.2;rack.3;3 #group3 Among records from same group (i.e. with same 1st and 2nd field - separated by ";"), I would need to keep the last record... (5 Replies)
Discussion started by: beca123456
5 Replies

5. Shell Programming and Scripting

Two columns-Common records - 20 files

Hi Friends, I have an input file like this cat input1 x 1 y 2 z 3 a 2 b 4 c 6 d 9 cat input2 x 7 h 8 k 9 l 5 m 9 d 12 (5 Replies)
Discussion started by: jacobs.smith
5 Replies

6. Shell Programming and Scripting

Compare multiple files, identify common records and combine unique values into one file

Good morning all, I have a problem that is one step beyond a standard awk compare. I would like to compare three files which have several thousand records against a fourth file. All of them have a value in each row that is identical, and one value in each of those rows which may be duplicated... (1 Reply)
Discussion started by: nashton
1 Replies

7. Shell Programming and Scripting

Common values in 2 columns in 2 files

Hello, Suppose I have these 2 tab delimited files, where the second column in first file contains matching values from first column of the second file, I would like to get an output like this: File A 1 A 2 B 3 C File B A Apple C Cinnabon B Banana I would like... (1 Reply)
Discussion started by: Mohamed EL Hadi
1 Replies

8. Shell Programming and Scripting

Shell script to filter records in a zip file that contains matching columns from another file

Not sure if this is the correct forum for this question. I have two files. file1.zip, file2 Input: file1.zip col1, col2 , col3 a , b , 0:0:0:0:0:c436:9346:d40b x, y, 0:0:0:0:0:880:39f9:c9a7 m, n , 0:0:0:0:0:80c7:9161:fe00 file2.txt col1 c4:36:93:46:d4:0b... (1 Reply)
Discussion started by: anil.v
1 Replies

9. UNIX for Beginners Questions & Answers

Finding common entries between 10 columns

Hello, I need to find the intersection across 10 columns. Kindly help. my file (INPUT.csv) looks like this 4_R 4_S 8_R 8_S 12_R 12_S 24_R 24_S LOC_Os01g01010 LOC_Os01g01010 LOC_Os01g01010 LOC_Os04g48290 LOC_Os01g01010 LOC_Os01g01010... (1 Reply)
Discussion started by: Sanchari
1 Replies

10. UNIX for Beginners Questions & Answers

Comparing fastq files and outputting common records

I have two files: File_1: @M04961:22:000000000-B5VGJ:1:1101:9280:7106 1:N:0:86 GGCATGAAAACATACAAACCGTCTTTCCAGAAATTGTTCCAAGTATCGGCAACAGCTTTATCAATACCATGAAAAATATCAACCACACCAGAAGCAGCAT + GGGGGGGGGGGGGGGGGCCGGGGGF,EDFFGEDFG,@DGGCGGEGGG7DCGGGF68CGFFFGGGG@CGDGFFDFEFEFF:30CGAFFDFEFF8CAF;;8F ... (3 Replies)
Discussion started by: Xterra
3 Replies
ogrinfo(1)						      General Commands Manual							ogrinfo(1)

NAME
ogrinfo - ogrinfo lists information about an OGR supported data source SYNOPSIS
ogrinfo [--help-general] [-ro] [-q] [-where restricted_where] [-spat xmin ymin xmax ymax] [-fid fid] [-sql statement] [-dialect dialect] [-al] [-so] [-fields={YES/NO}] [-geom={YES/NO/SUMMARY}][--formats] datasource_name [layer [layer ...]].fi DESCRIPTION
The ogrinfo program lists various information about an OGR supported data source to stdout (the terminal). -ro: Open the data source in read-only mode. -al: List all features of all layers (used instead of having to give layer names as arguments). -so: Summary Only: supress listing of features, show only the summary information like projection, schema, feature count and extents. -q: Quiet verbose reporting of various information, including coordinate system, layer schema, extents, and feature count. -where restricted_where: An attribute query in a restricted form of the queries used in the SQL WHERE statement. Only features matching the attribute query will be reported. -sql statement: Execute the indicated SQL statement and return the result. -dialect dialect: SQL dialect. In some cases can be used to use (unoptimized) OGR SQL instead of the native SQL of an RDBMS by passing OGRSQL. -spat xmin ymin xmax ymax: The area of interest. Only features within the rectangle will be reported. -fid fid: If provided, only the feature with this feature id will be reported. Operates exclusive of the spatial or attribute queries. Note: if you want to select several features based on their feature id, you can also use the fact the 'fid' is a special field recognized by OGR SQL. So, '-where 'fid in (1,3,5)'' would select features 1, 3 and 5. -fields={YES/NO}: (starting with GDAL 1.6.0) If set to NO, the feature dump will not display field values. Default value is YES. -geom={YES/NO/SUMMARY}: (starting with GDAL 1.6.0) If set to NO, the feature dump will not display the geometry. If set to SUMMARY, only a summary of the geometry will be displayed. If set to YES, the geometry will be reported in full OGC WKT format. Default value is YES. --formats: List the format drivers that are enabled. datasource_name: The data source to open. May be a filename, directory or other virtual name. See the OGR Vector Formats list for supported datasources. layer: One or more layer names may be reported. If no layer names are passed then ogrinfo will report a list of available layers (and their layerwide geometry type). If layer name(s) are given then their extents, coordinate system, feature count, geometry type, schema and all features matching query parameters will be reported to the terminal. If no query parameters are provided, all features are reported. Geometries are reported in OGC WKT format. EXAMPLE
Example reporting all layers in an NTF file: % ogrinfo wrk/SHETLAND_ISLANDS.NTF INFO: Open of `wrk/SHETLAND_ISLANDS.NTF' using driver `UK .NTF' successful. 1: BL2000_LINK (Line String) 2: BL2000_POLY (None) 3: BL2000_COLLECTIONS (None) 4: FEATURE_CLASSES (None) Example using an attribute query is used to restrict the output of the features in a layer: % ogrinfo -ro -where 'GLOBAL_LINK_ID=185878' wrk/SHETLAND_ISLANDS.NTF BL2000_LINK INFO: Open of `wrk/SHETLAND_ISLANDS.NTF' using driver `UK .NTF' successful. Layer name: BL2000_LINK Geometry: Line String Feature Count: 1 Extent: (419794.100000, 1069031.000000) - (419927.900000, 1069153.500000) Layer SRS WKT: PROJCS["OSGB 1936 / British National Grid", GEOGCS["OSGB 1936", DATUM["OSGB_1936", SPHEROID["Airy 1830",6377563.396,299.3249646]], PRIMEM["Greenwich",0], UNIT["degree",0.0174532925199433]], PROJECTION["Transverse_Mercator"], PARAMETER["latitude_of_origin",49], PARAMETER["central_meridian",-2], PARAMETER["scale_factor",0.999601272], PARAMETER["false_easting",400000], PARAMETER["false_northing",-100000], UNIT["metre",1]] LINE_ID: Integer (6.0) GEOM_ID: Integer (6.0) FEAT_CODE: String (4.0) GLOBAL_LINK_ID: Integer (10.0) TILE_REF: String (10.0) OGRFeature(BL2000_LINK):2 LINE_ID (Integer) = 2 GEOM_ID (Integer) = 2 FEAT_CODE (String) = (null) GLOBAL_LINK_ID (Integer) = 185878 TILE_REF (String) = SHETLAND I LINESTRING (419832.100 1069046.300,419820.100 1069043.800,419808.300 1069048.800,419805.100 1069046.000,419805.000 1069040.600,419809.400 1069037.400,419827.400 1069035.600,419842 1069031,419859.000 1069032.800,419879.500 1069049.500,419886.700 1069061.400,419890.100 1069070.500,419890.900 1069081.800,419896.500 1069086.800,419898.400 1069092.900,419896.700 1069094.800,419892.500 1069094.300,419878.100 1069085.600,419875.400 1069087.300,419875.100 1069091.100,419872.200 1069094.600,419890.400 1069106.400,419907.600 1069112.800,419924.600 1069133.800,419927.900 1069146.300,419927.600 1069152.400,419922.600 1069153.500,419917.100 1069153.500,419911.500 1069153.000,419908.700 1069152.500,419903.400 1069150.800,419898.800 1069149.400,419894.800 1069149.300,419890.700 1069149.400,419890.600 1069149.400,419880.800 1069149.800,419876.900 1069148.900,419873.100 1069147.500,419870.200 1069146.400,419862.100 1069143.000,419860 1069142,419854.900 1069138.600,419850 1069135,419848.800 1069134.100,419843 1069130,419836.200 1069127.600,419824.600 1069123.800,419820.200 1069126.900,419815.500 1069126.900,419808.200 1069116.500,419798.700 1069117.600,419794.100 1069115.100,419796.300 1069109.100,419801.800 1069106.800,419805.000 1069107.300) AUTHORS
Frank Warmerdam warmerdam@pobox.com, Silke Reimer silke@intevation.de GDAL
Tue Sep 18 2012 ogrinfo(1)
All times are GMT -4. The time now is 12:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy