Sponsored Content
Full Discussion: calculate from three files
Top Forums Shell Programming and Scripting calculate from three files Post 302156481 by radoulov on Tuesday 8th of January 2008 08:27:20 AM
Old 01-08-2008
Another one:

Code:
awk '
!f { f2[$1] = $2; next }
f == 3 { f3[$1] = $2; next }
f == 1 { $3 = (f2[$1] ? f2[$1] : 0)
    $4 = (f3[$1] ? f3[$1] : 0)
    $5 = $2 + f2[$1] - f3[$1]
}1' FS="|" OFS="|" file2 f=3 file3 f=1 file1

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

calculate size of some files

Hi, 1-I want to calculate the size of all files which are generated during last month in a directory. How can I do that ? Of cours, I find them by : $ls -l | grep jun but how to calculate the sum of their size ? 2- the same but for all files generated last month and before that. many thanks... (11 Replies)
Discussion started by: big123456
11 Replies

2. Shell Programming and Scripting

Calculate Files Created Today

I need to figure out how to get all the files from a certian dir ./123/*sat files and ./230/*sat files and several other directories which have these *sat files in them. I need to calculate how many were created today and how many yesterday from 2:00 pm on the 28th to 2pm on the 29th. It's a... (1 Reply)
Discussion started by: xgringo
1 Replies

3. Shell Programming and Scripting

How to calculate the entropy of a single directory that contains many files

Hello, I'm new member of shell scripting and i face some difficulties. To begin, i try to write an algorithm that calculate from one directory containing nfdump files (288) the entropy of one day 24hours. Each of the file is 5 min interval (nfdump -r nfcapd.200908250000 -s srcip) 1st (nfdump... (0 Replies)
Discussion started by: draxmas
0 Replies

4. Shell Programming and Scripting

Grep string from logs of last 1 hour on files of 2 different servers and calculate count

Hi, I am trying to grep a particular string from the files of 2 different servers without copying and calculate the total count of its occurence on both files. File structure is same on both servers and for reference as follows: 27-Aug-2010... (4 Replies)
Discussion started by: poweroflinux
4 Replies

5. Shell Programming and Scripting

Calculate age of a file | calculate time difference

Hello, I'm trying to create a shell script (#!/bin/sh) which should tell me the age of a file in minutes... I have a process, which delivers me all 15 minutes a new file and I want to have a monitoring script, which sends me an email, if the present file is older than 20 minutes. To do... (10 Replies)
Discussion started by: worm
10 Replies

6. Shell Programming and Scripting

Shell script to calculate the size of files

Dear all, Please help me to write a script that can calculate the size of files. For example: I have a directory which contain thousands of files. I need to know the size of files that their name begin with abc_123 Thank all!! (4 Replies)
Discussion started by: hainguyen1402
4 Replies

7. Programming

perl - calculate the number of lines from particular files

Hi, plz see the below code. here my aim is to calculate the number of lines in unprocessedData.out if this file contains 40 lines then lastly $linenum should print 40.(except blank lines) i have tried below code but it giving me the output only one. can anyone help me how to do ? ... (9 Replies)
Discussion started by: pspriyanka
9 Replies

8. Shell Programming and Scripting

How to calculate mode for several files HELPPPP!!

Hello my problem is that: I have several files with 4 columns and I want to calculate mode of 4th column for each file and write 2nd 3rd and mode value as an output file. Here is an example of my files: 2005-01-21 05:30:00 0.518736 -163 2005-01-20 05:30:00 0.518736 -160... (3 Replies)
Discussion started by: Heaven
3 Replies

9. Red Hat

Du -sh command taking time to calculate the big size files

Hi , My linux server is taking more time to calculate big size from long time. * i am accessing server through ssh * commands # - du -sh * #du -sh * | sort -n | grep G Please guide me for fast way to find big size directories under to / partition Thanks (8 Replies)
Discussion started by: Nats
8 Replies

10. Shell Programming and Scripting

Calculate percent using values in 2 files

Trying to use file1 which is the actual counts in $2 associated with each $1 entry. The total of each $1 is in file2 with the total in $3. So when there is a match between $1 in file1 with $1 in file2, then the % is calculated using the $2 value of file1 and $3 value of file2. Thank you :). ... (4 Replies)
Discussion started by: cmccabe
4 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 03:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy