Sponsored Content
Top Forums UNIX for Beginners Questions & Answers Sort by record column, Compare with conditons and export the result Post 303012945 by Usagi on Monday 12th of February 2018 05:03:52 PM
Old 02-12-2018
Sort by record column, Compare with conditons and export the result

Hello,

I am new to Unix and would like to seek a help, please.

I have 2 files (file_1 and file_2), I need to perform the following actions.
1 ) Sort the both file by the column 26-36 (which is Invoice number)
what is sort command with the column sort?

2) Compare the file_1.sorted and file_2.sorted. I would like Unix to ignore the difference when the differences are data stamp.
The data stamp is in Record 0010 and Record 2000. (Record ID is in column 92-95)
Date stamp in Record 0010 is in the column 451 -471.
Date stamp in Record 2000 is in the column 356 -385.
My goal is only displays the difference other than the date stamps.
what is the Unix command for the compare?

3) Would like to set nowrap and export the result in text file.

Thank you so much for your help in advance.
Usagi
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

find common lines using just one column to compare and result with all columns

Hi. If we have this file A B C 7 8 9 1 2 10 and this other file A C D F 7 9 2 3 9 2 3 4 The result i´m looking for is intersection with A B C D F so the answer here will be (10 Replies)
Discussion started by: alcalina
10 Replies

2. Shell Programming and Scripting

Compare to files and export only different values

Hello, I need to compare two files which have the following structure File1: No : 1 Name : George/Brown Value2 : type2 Value3 : type3 Date : Wed Oct 20 11:12:58 2010 Value : yes No : 2 Name : John/Cash Value2 :... (4 Replies)
Discussion started by: @dagio
4 Replies

3. Shell Programming and Scripting

start searching a word from the particular record on the result of first occurence change the value

Hi, I need a script to start searching a word from the particular record on the result of first occurence i need to change the value in that record. I have a input file like this <properties> <add key="DeliveryWithinDay" value="False" /> <add key="ABC" value="23:00:00 PM" /> <add... (5 Replies)
Discussion started by: NareshN
5 Replies

4. UNIX for Advanced & Expert Users

How to export Result to Excel Tabular format from UNIX?

Hi I am working on a script in which I am firing a query on database through Unix and getting the result set. I want to export that in an excel file. I am able to do so nut the result are exported horizontally one below the other. Can anyone plss help me out in exporting the Result in Tabular... (4 Replies)
Discussion started by: Saritau3
4 Replies

5. Shell Programming and Scripting

How to compare current record,with next and previous record in awk without using array?

Hi! all can any one tell me how to compare current record of column with next and previous record in awk without using array my case is like this input.txt 0 32 1 26 2 27 3 34 4 26 5 25 6 24 9 23 0 32 1 28 2 15 3 26 4 24 (7 Replies)
Discussion started by: Dona Clara
7 Replies

6. Shell Programming and Scripting

Problem facing to compare different column and print out record with smallest number

Hi, Input file 1 : 37170 37196 77 51 37174 37195 73 52 37174 37194 73 53 Desired Output file 1 : 37170 37196 77 51 Input file 2 : 37174 37195 73 0 37170 37196 77 0 Desired Output file 2 : 37174 37195 73 0 (1 Reply)
Discussion started by: cpp_beginner
1 Replies

7. UNIX for Dummies Questions & Answers

Match sum of values in each column with the corresponding column value present in trailer record

Hi All, I have a requirement where I need to find sum of values from column D through O present in a CSV file and check whether the sum of each Individual column matches with the value present for that corresponding column present in the trailer record. For example, let's assume for column D... (9 Replies)
Discussion started by: tpk
9 Replies

8. Shell Programming and Scripting

How to compare the current result with previous line result.?

Hi Gurus, I have requirement to compare current result with previous reuslt. The sample case is below. 1 job1 1 1 job2 2 1 job3 3 2 job_a1 1 2 job_a2 2 2 job_a3 3 3 job_b1 1 3 job_b2 2 for above sample file, GID is group ID, for input line, the job run... (1 Reply)
Discussion started by: ken6503
1 Replies

9. Shell Programming and Scripting

Split column data if the table has n number of column's with some record

Split column data if the table has n number of column's with some record then how to split n number of colmn's line by line with records Table --------- Col1 col2 col3 col4 ....................col20 1 2 3 4 .................... 20 a b c d .................... v ... (11 Replies)
Discussion started by: Priti2277
11 Replies

10. UNIX for Beginners Questions & Answers

Add column and multiply its result to all elements of another column

Input file is as follows: 1 | 6 2 | 7 3 | 8 4 | 9 5 | 10 Output reuired (sum of the first column $1*$2) 1 | 6 | 90 2 | 7 | 105 3 | 8 | 120 4 |9 | 135 5 |10 | 150 Please enclose sample input, sample output, and code... (5 Replies)
Discussion started by: Sagar Singh
5 Replies
NCDIFF(1)						      General Commands Manual							 NCDIFF(1)

NAME
ncdiff - netCDF Differencer SYNTAX
ncdiff [-3] [-4] [-6] [-A] [-C] [-c] [-D dbg] [-d dim,[ min][,[ max]]] [-F] [-h] [-L dfl_lvl] [-l path] [-O] [-p path] [-R] [-r] [-v var[,...]] [-x] file_1 file_2 file_3 DESCRIPTION
ncdiff subtracts variables in file_2 from the corresponding variables (those with the same name) in file_1 and stores the results in file_3. Variables in file_2 are broadcast to conform to the corresponding variable in file_1 if necessary. Broadcasting a variable means creating data in non-existing dimensions from the data in existing dimensions. For example, a two dimensional variable in file_2 can be subtracted from a four, three, or two (but not one or zero) dimensional variable (of the same name) in file_1. This functionality allows the user to compute anomalies from the mean. Note that variables in file_1 are not broadcast to conform to the dimensions in file_2. Thus, ncdiff, the number of dimensions, or rank, of any processed variable in file_1 must be greater than or equal to the rank of the same variable in file_2. Furthermore, the size of all dimensions common to both file_1 and file_2 must be equal. When computing anomalies from the mean it is often the case that file_2 was created by applying an averaging operator to a file with the same dimensions as file_1, if not file_1 itself. In these cases, creating file_2 with ncra rather than ncwa will cause the ncdiff opera- tion to fail. For concreteness say the record dimension in file_1 is time. If file_2 were created by averaging file_1 over the time dimension with the ncra operator rather than with the ncwa operator, then file_2 will have a time dimension of size 1 rather than having no time dimension at all In this case the input files to ncdiff, file_1 and file_2, will have unequally sized time dimensions which causes ncdiff to fail. To prevent this from occuring, use ncwa to remove the time dimension from file_2. An example is given below. ncdiff will never difference coordinate variables or variables of type NC_CHAR or NC_BYTE. This ensures that coordinates like (e.g., lati- tude and longitude) are physically meaningful in the output file, file_3. This behavior is hardcoded. ncdiff applies special rules to some NCAR CSM fields (e.g., ORO). See NCAR CSM Conventions for a complete description. Finally, we note that ncflint (ncflint netCDF File Interpolator) can be also perform file subtraction (as well as addition, multiplication and interpolation). EXAMPLES
Say files 85_0112.nc and 86_0112.nc each contain 12 months of data. Compute the change in the monthly averages from 1985 to 1986: ncdiff 86_0112.nc 85_0112.nc 86m85_0112.nc The following examples demonstrate the broadcasting feature of ncdiff. Say we wish to compute the monthly anomalies of T from the yearly average of T for the year 1985. First we create the 1985 average from the monthly data, which is stored with the record dimension time. ncra 85_0112.nc 85.nc ncwa -O -a time 85.nc 85.nc The second command, ncwa, gets rid of the time dimension of size 1 that ncra left in 85.nc. Now none of the variables in 85.nc has a time dimension. A quicker way to accomplish this is to use ncwa from the beginning: ncwa -a time 85_0112.nc 85.nc We are now ready to use ncdiff to compute the anomalies for 1985: ncdiff -v T 85_0112.nc 85.nc t_anm_85_0112.nc Each of the 12 records in t_anm_85_0112.nc now contains the monthly deviation of T from the annual mean of T for each gridpoint. Say we wish to compute the monthly gridpoint anomalies from the zonal annual mean. A zonal mean is a quantity that has been averaged over the longitudinal (or x) direction. First we use ncwa to average over longitudinal direction lon, creating xavg_85.nc, the zonal mean of 85.nc. Then we use ncdiff to subtract the zonal annual means from the monthly gridpoint data: ncwa -a lon 85.nc xavg_85.nc ncdiff 85_0112.nc xavg_85.nc tx_anm_85_0112.nc Assuming 85_0112.nc has dimensions time and lon, this example only works if xavg_85.nc has no time or lon dimension. As a final example, say we have five years of monthly data (i.e., 60 months) stored in 8501_8912.nc and we wish to create a file which con- tains the twelve month seasonal cycle of the average monthly anomaly from the five-year mean of this data. The following method is just one permutation of many which will accomplish the same result. First use ncwa to create the file containing the five-year mean: ncwa -a time 8501_8912.nc 8589.nc Next use ncdiff to create a file containing the difference of each month's data from the five-year mean: ncdiff 8501_8912.nc 8589.nc t_anm_8501_8912.nc Now use ncks to group the five January anomalies together in one file, and use ncra to create the average anomaly for all five Januarys. These commands are embedded in a shell loop so they are repeated for all twelve months: foreach idx (01 02 03 04 05 06 07 08 09 10 11 12) ncks -F -d time,,,12 t_anm_8501_8912.nc foo. ncra foo. t_anm_8589_.nc end Note that ncra understands the stride argument so the two commands inside the loop may be combined into the single command ncra -F -d time,,,12 t_anm_8501_8912.nc foo. Finally, use ncrcat to concatenate the 12 average monthly anomaly files into one twelve-record file which contains the entire seasonal cycle of the monthly anomalies: ncrcat t_anm_8589_??.nc t_anm_8589_0112.nc AUTHOR
NCO manual pages written by Charlie Zender and Brian Mays. REPORTING BUGS
Report bugs to <http://sf.net/bugs/?group_id=3331>. COPYRIGHT
Copyright (C) 1995-2011 Charlie Zender This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICU- LAR PURPOSE. SEE ALSO
The full documentation for NCO is maintained as a Texinfo manual called the NCO User's Guide. Because NCO is mathematical in nature, the documentation includes TeX-intensive portions not viewable on character-based displays. Hence the only complete and authoritative versions of the NCO User's Guide are the PDF (recommended), DVI, and Postscript versions at <http://nco.sf.net/nco.pdf>, <http://nco.sf.net/nco.dvi>, and <http://nco.sf.net/nco.ps>, respectively. HTML and XML versions are available at <http://nco.sf.net/nco.html> and <http://nco.sf.net/nco.xml>, respectively. If the info and NCO programs are properly installed at your site, the command info nco should give you access to the complete manual, except for the TeX-intensive portions. HOMEPAGE
The NCO homepage at <http://nco.sf.net> contains more information. NCDIFF(1)
All times are GMT -4. The time now is 03:01 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy