Sponsored Content
Top Forums Shell Programming and Scripting Awk: Replacement using 2 diff files input and comparison Post 302883410 by Akshay Hegde on Tuesday 14th of January 2014 02:07:39 AM
Old 01-14-2014
You can try something like this, as Scrutinizer already suggested


Code:
awk    '
  
       FNR==1{
                    ++counter
             }
  counter==1 {
                ACTFILE[$1]=$2 FS $3 FS $4 FS $5 FS $6 FS $7
                next
             }
  counter==2 {
                DEACTFILE[$1]=$2 FS $3 FS $4 FS $5 FS $6 FS $7
                next
             }
function date_format(vin){
                             # For 20140114100944 
                             year = substr(vin,1,4)
                             mon  = substr(vin,5,2)
                             day  = substr(vin,7,2)
                             hr   = substr(vin,9,2)  ? substr(vin,9,2) : 00
                             min  = substr(vin,11,2) ? substr(vin,11,2): 00
                             sec  = substr(vin,13)   ? substr(vin,13)  : 00
                             return year" "mon" "day" "hr" "min" "sec
                         }
              {
                 timeip = $5 ? mktime(date_format($5)) : NULL
                      if( $1 in DEACTFILE){
                                           n =split(DEACTFILE[$1],A)
                                           dfiletime = mktime(date_format(A[n]))
                                          if(timeip < dfiletime)
                                              print A[1],A[2],A[3],A[4],A[5],$8,$9+$10 >"ok_file"
                
                                          } 
                      if( $1 in ACTFILE)  {
                                           n =split(ACTFILE[$1],A)
                                           actfiletime = mktime(date_format(A[n]))
                                           if(timeip > actfiletime)
                                               print A[1],A[2],A[3],A[4],A[5],$8,$9+$10 >"No_ok_file" 
                                          }
              }
           ' FS="|" OFS="|" act deact ip

This User Gave Thanks to Akshay Hegde For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

String Comparison between two files using awk

I have two files with field seperator as "~". File A: 12~13~14~15 File B: 22~22~32~11 i want to calculate the difference between two files and than calculate the percentage difference and output it to a new file. How do i do this using awk. Also please suggest GOOD awk tutorials. Thank... (7 Replies)
Discussion started by: rudoraj
7 Replies

2. Shell Programming and Scripting

Comparison of two files in awk

Hi, I have two files file1 and file2 delimited by semicolon, And I want to compare column 2 and column3 of file1 to column3 and column 4 in file2. file1 -------- abc;cef;155.67;143_34; def;fgh;146.55;123.3; frg;hff;134.67;; yyy;fgh;134.78;35_45; file 2 --------- abc;cef;155.09;;... (12 Replies)
Discussion started by: jerome Sukumar
12 Replies

3. Shell Programming and Scripting

Awk Comparison of 2 specific files

Hi Everybody, I know the topic sounds familiar but I just couldn't adapt or find the right code that solves my particular issue. I really hope you can help. I would like to compare 2 files in an awk script. Both files have different paths. The awk script call should look like that awk -f... (7 Replies)
Discussion started by: hhoosscchhii
7 Replies

4. Shell Programming and Scripting

Diff between 2 files using awk

Hi Experts, Could you please help me to find the difference between two files. I tried the diff command but did not like the output as it contained < and > signs and the line numbers. Is it possible to do something using awk? I have two files, say File1.txt contains 5 values and File2.txt... (6 Replies)
Discussion started by: forumthreads
6 Replies

5. Shell Programming and Scripting

Comparison and editing of files using awk.(And also a possible bug in awk for loop?)

I have two files which I would like to compare and then manipulate in a way. File1: pictures.txt 1.1 1.3 dance.txt 1.2 1.4 treehouse.txt 1.3 1.5 File2: pictures.txt 1.5 ref2313 1.4 ref2345 1.3 ref5432 1.2 ref4244 dance.txt 1.6 ref2342 1.5 ref2352 1.4 ref0695 1.3 ref5738 1.2... (1 Reply)
Discussion started by: linuxkid
1 Replies

6. UNIX for Dummies Questions & Answers

df -> output files; comparison using awk or...

:wall: I am trying to do the following using awk (is that the best way?): Read 2 files created from the output of df (say, on different days) and compare the entries using the 1st (FileSys) and 6th (Mount) fields to see if the size has changed. Output (at least), to a new file (some header... (2 Replies)
Discussion started by: renata
2 Replies

7. Shell Programming and Scripting

Show the diff in two files using awk

Hi, How can i use AWK or any other commands to find the difference between 2 files. File A aaa bbb ccc 111 222 File B aaa ccc 111 Output bbb 222 (6 Replies)
Discussion started by: gambit97
6 Replies

8. Shell Programming and Scripting

comparison of 2 files using unix or awk

Hello, I have 2 files and I want them to be compared in a specific fashion file1: A_1200_1250 A_1251_1300 B_1301_1350 B_1351_1400 B_1401_1450 C_1451_1500 and so on... file2: 1210 1305 1260 1295 1400 1500 1450 1495 Now The script should look for "1200" from A_1200_1250 of... (8 Replies)
Discussion started by: Diya123
8 Replies

9. UNIX for Dummies Questions & Answers

diff then awk two files

Hi friends, i am trying to diff two files and the result will be passed to awk and this will get the first 20 characters in every line and put the result in a file.... but i can't generate an output. $ cat file1.txt 1 2 3 4 5 $ cat file2.txt 1 2 3 4 the line of command is: (2 Replies)
Discussion started by: kokoro
2 Replies

10. UNIX for Beginners Questions & Answers

awk comparison using multiple files

Hi, I have 2 files, I need to use column of file1 and do a comparison on file2 column 1 and print the mismatch is file3 as mentioned below. Kindly consider that file 1 is having uniq key(column) whereas in file2 we have multiple duplicates (like 44). These duplicates should not come in... (2 Replies)
Discussion started by: grv
2 Replies
DateTime::Locale::fur_IT(3)				User Contributed Perl Documentation			       DateTime::Locale::fur_IT(3)

NAME
DateTime::Locale::fur_IT SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'fur_IT' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Friulian Italy. DATA
This locale inherits from the DateTime::Locale::fur locale. It contains the following data. Days Wide (format) lunis martars miercus joibe vinars sabide domenie Abbreviated (format) lun mar mie joi vin sab dom Narrow (format) L M M J V S D Wide (stand-alone) lunis martars miercus joibe vinars sabide domenie Abbreviated (stand-alone) lun mar mie joi vin sab dom Narrow (stand-alone) L M M J V S D Months Wide (format) Zenar Fevrar Marc Avril Mai Jugn Lui Avost Setembar Otubar Novembar Dicembar Abbreviated (format) Zen Fev Mar Avr Mai Jug Lui Avo Set Otu Nov Dic Narrow (format) Z F M A M J L A S O N D Wide (stand-alone) Zenar Fevrar Marc Avril Mai Jugn Lui Avost Setembar Otubar Novembar Dicembar Abbreviated (stand-alone) Zen Fev Mar Avr Mai Jug Lui Avo Set Otu Nov Dic Narrow (stand-alone) Z F M A M J L A S O N D Quarters Wide (format) Prin trimestri Secont trimestri Tierc trimestri Cuart trimestri Abbreviated (format) T1 T2 T3 T4 Narrow (format) 1 2 3 4 Wide (stand-alone) Prin trimestri Secont trimestri Tierc trimestri Cuart trimestri Abbreviated (stand-alone) T1 T2 T3 T4 Narrow (stand-alone) 1 2 3 4 Eras Wide pdC ddC Abbreviated pdC ddC Narrow pdC ddC Date Formats Full 2008-02-05T18:30:30 = martars 5 di Fevrar dal 2008 1995-12-22T09:05:02 = vinars 22 di Dicembar dal 1995 -0010-09-15T04:44:23 = sabide 15 di Setembar dal -10 Long 2008-02-05T18:30:30 = 5 di Fevrar dal 2008 1995-12-22T09:05:02 = 22 di Dicembar dal 1995 -0010-09-15T04:44:23 = 15 di Setembar dal -10 Medium 2008-02-05T18:30:30 = 05/02/2008 1995-12-22T09:05:02 = 22/12/1995 -0010-09-15T04:44:23 = 15/09/-010 Short 2008-02-05T18:30:30 = 05/02/08 1995-12-22T09:05:02 = 22/12/95 -0010-09-15T04:44:23 = 15/09/-10 Default 2008-02-05T18:30:30 = 05/02/2008 1995-12-22T09:05:02 = 22/12/1995 -0010-09-15T04:44:23 = 15/09/-010 Time Formats Full 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Long 2008-02-05T18:30:30 = 18:30:30 UTC 1995-12-22T09:05:02 = 09:05:02 UTC -0010-09-15T04:44:23 = 04:44:23 UTC Medium 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Short 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 09:05 -0010-09-15T04:44:23 = 04:44 Default 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 09:05:02 -0010-09-15T04:44:23 = 04:44:23 Datetime Formats Full 2008-02-05T18:30:30 = martars 5 di Fevrar dal 2008 18:30:30 UTC 1995-12-22T09:05:02 = vinars 22 di Dicembar dal 1995 09:05:02 UTC -0010-09-15T04:44:23 = sabide 15 di Setembar dal -10 04:44:23 UTC Long 2008-02-05T18:30:30 = 5 di Fevrar dal 2008 18:30:30 UTC 1995-12-22T09:05:02 = 22 di Dicembar dal 1995 09:05:02 UTC -0010-09-15T04:44:23 = 15 di Setembar dal -10 04:44:23 UTC Medium 2008-02-05T18:30:30 = 05/02/2008 18:30:30 1995-12-22T09:05:02 = 22/12/1995 09:05:02 -0010-09-15T04:44:23 = 15/09/-010 04:44:23 Short 2008-02-05T18:30:30 = 05/02/08 18:30 1995-12-22T09:05:02 = 22/12/95 09:05 -0010-09-15T04:44:23 = 15/09/-10 04:44 Default 2008-02-05T18:30:30 = 05/02/2008 18:30:30 1995-12-22T09:05:02 = 22/12/1995 09:05:02 -0010-09-15T04:44:23 = 15/09/-010 04:44:23 Available Formats d (d) 2008-02-05T18:30:30 = 5 1995-12-22T09:05:02 = 22 -0010-09-15T04:44:23 = 15 EEEd (d EEE) 2008-02-05T18:30:30 = 5 mar 1995-12-22T09:05:02 = 22 vin -0010-09-15T04:44:23 = 15 sab Hm (H:mm) 2008-02-05T18:30:30 = 18:30 1995-12-22T09:05:02 = 9:05 -0010-09-15T04:44:23 = 4:44 hm (h:mm a) 2008-02-05T18:30:30 = 6:30 p. 1995-12-22T09:05:02 = 9:05 a. -0010-09-15T04:44:23 = 4:44 a. Hms (H:mm:ss) 2008-02-05T18:30:30 = 18:30:30 1995-12-22T09:05:02 = 9:05:02 -0010-09-15T04:44:23 = 4:44:23 hms (h:mm:ss a) 2008-02-05T18:30:30 = 6:30:30 p. 1995-12-22T09:05:02 = 9:05:02 a. -0010-09-15T04:44:23 = 4:44:23 a. M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (d/M) 2008-02-05T18:30:30 = 5/2 1995-12-22T09:05:02 = 22/12 -0010-09-15T04:44:23 = 15/9 MEd (E d/M) 2008-02-05T18:30:30 = mar 5/2 1995-12-22T09:05:02 = vin 22/12 -0010-09-15T04:44:23 = sab 15/9 MMd (d/MM) 2008-02-05T18:30:30 = 5/02 1995-12-22T09:05:02 = 22/12 -0010-09-15T04:44:23 = 15/09 MMM (LLL) 2008-02-05T18:30:30 = Fev 1995-12-22T09:05:02 = Dic -0010-09-15T04:44:23 = Set MMMd (d MMM) 2008-02-05T18:30:30 = 5 Fev 1995-12-22T09:05:02 = 22 Dic -0010-09-15T04:44:23 = 15 Set MMMEd (E d MMM) 2008-02-05T18:30:30 = mar 5 Fev 1995-12-22T09:05:02 = vin 22 Dic -0010-09-15T04:44:23 = sab 15 Set MMMMd (d 'di' MMMM) 2008-02-05T18:30:30 = 5 di Fevrar 1995-12-22T09:05:02 = 22 di Dicembar -0010-09-15T04:44:23 = 15 di Setembar MMMMEd (E d MMMM) 2008-02-05T18:30:30 = mar 5 Fevrar 1995-12-22T09:05:02 = vin 22 Dicembar -0010-09-15T04:44:23 = sab 15 Setembar ms (mm:ss) 2008-02-05T18:30:30 = 30:30 1995-12-22T09:05:02 = 05:02 -0010-09-15T04:44:23 = 44:23 y (y) 2008-02-05T18:30:30 = 2008 1995-12-22T09:05:02 = 1995 -0010-09-15T04:44:23 = -10 yM (M/yyyy) 2008-02-05T18:30:30 = 2/2008 1995-12-22T09:05:02 = 12/1995 -0010-09-15T04:44:23 = 9/-010 yMEd (EEE, d/M/yyyy) 2008-02-05T18:30:30 = mar, 5/2/2008 1995-12-22T09:05:02 = vin, 22/12/1995 -0010-09-15T04:44:23 = sab, 15/9/-010 yMMM (MMM y) 2008-02-05T18:30:30 = Fev 2008 1995-12-22T09:05:02 = Dic 1995 -0010-09-15T04:44:23 = Set -10 yMMMEd (EEE d MMM y) 2008-02-05T18:30:30 = mar 5 Fev 2008 1995-12-22T09:05:02 = vin 22 Dic 1995 -0010-09-15T04:44:23 = sab 15 Set -10 yMMMM (LLLL 'dal' y) 2008-02-05T18:30:30 = Fevrar dal 2008 1995-12-22T09:05:02 = Dicembar dal 1995 -0010-09-15T04:44:23 = Setembar dal -10 yQ (Q yyyy) 2008-02-05T18:30:30 = 1 2008 1995-12-22T09:05:02 = 4 1995 -0010-09-15T04:44:23 = 3 -010 yQQQ (QQQ y) 2008-02-05T18:30:30 = T1 2008 1995-12-22T09:05:02 = T4 1995 -0010-09-15T04:44:23 = T3 -10 yyMM (MM/yy) 2008-02-05T18:30:30 = 02/08 1995-12-22T09:05:02 = 12/95 -0010-09-15T04:44:23 = 09/-10 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 yyyyMMMM (MMMM y) 2008-02-05T18:30:30 = Fevrar 2008 1995-12-22T09:05:02 = Dicembar 1995 -0010-09-15T04:44:23 = Setembar -10 Miscellaneous Prefers 24 hour time? Yes Local first day of the week lunis SUPPORT
See DateTime::Locale. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT
Copyright (c) 2008 David Rolsky. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. This module was generated from data provided by the CLDR project, see the LICENSE.cldr in this distribution for details on the CLDR data's license. perl v5.18.2 2017-10-06 DateTime::Locale::fur_IT(3)
All times are GMT -4. The time now is 07:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy