Sponsored Content
Top Forums Shell Programming and Scripting Calculating differences line by line Post 302779321 by SkySmart on Tuesday 12th of March 2013 01:23:52 PM
Old 03-12-2013
the contents of the datafile changed:

Code:
jime=1860,yime=1.23243,lime=[Mar-12-(UTC)]
jime=1859,yime=1.23018,lime=[Mar-12-(UTC)]
jime=1825,yime=1.15371,lime=[Mar-12-(UTC)]
jime=1849,yime=1.20769,lime=[Mar-12-(UTC)]
jime=1841,yime=1.1897,lime=[Mar-12-(UTC)]
jime=1849,yime=1.20769,lime=[Mar-12-(UTC)]

i tried manipulating the fields so the script can adapt to this new datafile layout. "$NF" to work on the second column:

Code:
awk -F= '{prev=$3; print; getline; print $0","($NF-prev)/$NF*100"%"}' datafile

but i keep getting:

Code:
awk: (FILENAME=mile FNR=2) fatal: division by zero attempted

 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

[Solved] Problem in reading a file line by line till it reaches a white line

So, I want to read line-by-line a text file with unknown number of files.... So: a=1 b=1 while ; do b=`sed -n '$ap' test` a=`expr $a + 1` $here do something with b etc done the problem is that sed does not seem to recognise the $a, even when trying sed -n ' $a p' So, I cannot read... (3 Replies)
Discussion started by: hakermania
3 Replies

2. Solaris

Line too long error Replace string with new line line character

I get a file which has all its content in a single row. The file contains xml data containing 3000 records, but all in a single row, making it difficult for Unix to Process the file. I decided to insert a new line character at all occurrences of a particular string in this file (say replacing... (4 Replies)
Discussion started by: ducati
4 Replies

3. Shell Programming and Scripting

How to make diff show differences one line at a time and not group them?

Is there a way to tell diff to show differences one line at a time and not to group them? For example, I have two files: file1: line 1 line 2 line 3 diff line 4 diff line 5 diff line 6 line 7 file2: line 1 line 2 line 3 diff. line 4 diff. line 5 diff. line 6 line 7 (13 Replies)
Discussion started by: mmr11408
13 Replies

4. Shell Programming and Scripting

how to read the contents of two files line by line and compare the line by line?

Hi All, I'm trying to figure out which are the trusted-ips and which are not using a script file.. I have a file named 'ip-list.txt' which contains some ip addresses and another file named 'trusted-ip-list.txt' which also contains some ip addresses. I want to read a line from... (4 Replies)
Discussion started by: mjavalkar
4 Replies

5. Shell Programming and Scripting

Calculating average for every Nth line in the Nth column

Is there an awk script that can easily perform the following operation? I have a data file that is in the format of 1944-12,5.6 1945-01,9.8 1945-02,6.7 1945-03,9.3 1945-04,5.9 1945-05,0.7 1945-06,0.0 1945-07,0.0 1945-08,0.0 1945-09,0.0 1945-10,0.2 1945-11,10.5 1945-12,22.3... (3 Replies)
Discussion started by: ncwxpanther
3 Replies

6. Shell Programming and Scripting

Need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line...

Hello, I need a program that read a file line by line and prints out lines 1, 2 & 3 after an empty line... An example of entries in the file would be: SRVXPAPI001 ERRO JUN24 07:28:34 1775 REASON= 0000, PROCID= #E506 #1065: TPCIPPR, INDEX= 003F ... (8 Replies)
Discussion started by: Ferocci
8 Replies

7. Shell Programming and Scripting

How to read file line by line and compare subset of 1st line with 2nd?

Hi all, I have a log file say Test.log that gets updated continuously and it has data in pipe separated format. A sample log file would look like: <date1>|<data1>|<url1>|<result1> <date2>|<data2>|<url2>|<result2> <date3>|<data3>|<url3>|<result3> <date4>|<data4>|<url4>|<result4> What I... (3 Replies)
Discussion started by: pat_pramod
3 Replies

8. UNIX for Beginners Questions & Answers

Get an output of lines in pattern 1st line then 10th line then 11th line then 20th line and so on.

Input file: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 (6 Replies)
Discussion started by: Sagar Singh
6 Replies
DateTime::Locale::sq(3) 				User Contributed Perl Documentation				   DateTime::Locale::sq(3)

NAME
DateTime::Locale::sq SYNOPSIS
use DateTime; my $dt = DateTime->now( locale => 'sq' ); print $dt->month_name(); DESCRIPTION
This is the DateTime locale package for Albanian. DATA
This locale inherits from the DateTime::Locale::root locale. It contains the following data. Days Wide (format) e heenee e martee e meerkuree e enjte e premte e shtunee e diel Abbreviated (format) Heen Mar Meer Enj Pre Sht Die Narrow (format) H M M E P S D Wide (stand-alone) e heenee e martee e meerkuree e enjte e premte e shtunee e diel Abbreviated (stand-alone) Heen Mar Meer Enj Pre Sht Die Narrow (stand-alone) H M M E P S D Months Wide (format) janar shkurt mars prill maj qershor korrik gusht shtator tetor neentor dhjetor Abbreviated (format) Jan Shk Mar Pri Maj Qer Kor Gsh Sht Tet Neen Dhj Narrow (format) J S M P M Q K G S T N D Wide (stand-alone) janar shkurt mars prill maj qershor korrik gusht shtator tetor neentor dhjetor Abbreviated (stand-alone) Jan Shk Mar Pri Maj Qer Kor Gsh Sht Tet Neen Dhj Narrow (stand-alone) J S M P M Q K G S T N D Quarters Wide (format) Q1 Q2 Q3 Q4 Abbreviated (format) Q1 Q2 Q3 Q4 Narrow (format) 1 2 3 4 Wide (stand-alone) Q1 Q2 Q3 Q4 Abbreviated (stand-alone) Q1 Q2 Q3 Q4 Narrow (stand-alone) 1 2 3 4 Eras Wide BCE CE Abbreviated p.e.r. n.e.r. Narrow p.e.r. n.e.r. Date Formats Full 2008-02-05T18:30:30 = e martee, 05 shkurt 2008 1995-12-22T09:05:02 = e premte, 22 dhjetor 1995 -0010-09-15T04:44:23 = e shtunee, 15 shtator -10 Long 2008-02-05T18:30:30 = 05 shkurt 2008 1995-12-22T09:05:02 = 22 dhjetor 1995 -0010-09-15T04:44:23 = 15 shtator -10 Medium 2008-02-05T18:30:30 = 2008-02-05 1995-12-22T09:05:02 = 1995-12-22 -0010-09-15T04:44:23 = -010-09-15 Short 2008-02-05T18:30:30 = 08-02-05 1995-12-22T09:05:02 = 95-12-22 -0010-09-15T04:44:23 = -10-09-15 Default 2008-02-05T18:30:30 = 2008-02-05 1995-12-22T09:05:02 = 1995-12-22 -0010-09-15T04:44:23 = -010-09-15 Time Formats Full 2008-02-05T18:30:30 = 6.30.30.MD UTC 1995-12-22T09:05:02 = 9.05.02.PD UTC -0010-09-15T04:44:23 = 4.44.23.PD UTC Long 2008-02-05T18:30:30 = 6.30.30.MD UTC 1995-12-22T09:05:02 = 9.05.02.PD UTC -0010-09-15T04:44:23 = 4.44.23.PD UTC Medium 2008-02-05T18:30:30 = 6.30.30.MD 1995-12-22T09:05:02 = 9.05.02.PD -0010-09-15T04:44:23 = 4.44.23.PD Short 2008-02-05T18:30:30 = 6.30.MD 1995-12-22T09:05:02 = 9.05.PD -0010-09-15T04:44:23 = 4.44.PD Default 2008-02-05T18:30:30 = 6.30.30.MD 1995-12-22T09:05:02 = 9.05.02.PD -0010-09-15T04:44:23 = 4.44.23.PD Datetime Formats Full 2008-02-05T18:30:30 = e martee, 05 shkurt 2008 6.30.30.MD UTC 1995-12-22T09:05:02 = e premte, 22 dhjetor 1995 9.05.02.PD UTC -0010-09-15T04:44:23 = e shtunee, 15 shtator -10 4.44.23.PD UTC Long 2008-02-05T18:30:30 = 05 shkurt 2008 6.30.30.MD UTC 1995-12-22T09:05:02 = 22 dhjetor 1995 9.05.02.PD UTC -0010-09-15T04:44:23 = 15 shtator -10 4.44.23.PD UTC Medium 2008-02-05T18:30:30 = 2008-02-05 6.30.30.MD 1995-12-22T09:05:02 = 1995-12-22 9.05.02.PD -0010-09-15T04:44:23 = -010-09-15 4.44.23.PD Short 2008-02-05T18:30:30 = 08-02-05 6.30.MD 1995-12-22T09:05:02 = 95-12-22 9.05.PD -0010-09-15T04:44:23 = -10-09-15 4.44.PD Default 2008-02-05T18:30:30 = 2008-02-05 6.30.30.MD 1995-12-22T09:05:02 = 1995-12-22 9.05.02.PD -0010-09-15T04:44:23 = -010-09-15 4.44.23.PD 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 Pre -0010-09-15T04:44:23 = 15 Sht 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 MD 1995-12-22T09:05:02 = 9:05 PD -0010-09-15T04:44:23 = 4:44 PD 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 MD 1995-12-22T09:05:02 = 9:05:02 PD -0010-09-15T04:44:23 = 4:44:23 PD M (L) 2008-02-05T18:30:30 = 2 1995-12-22T09:05:02 = 12 -0010-09-15T04:44:23 = 9 Md (M-d) 2008-02-05T18:30:30 = 2-5 1995-12-22T09:05:02 = 12-22 -0010-09-15T04:44:23 = 9-15 MEd (E, d.M) 2008-02-05T18:30:30 = Mar, 5.2 1995-12-22T09:05:02 = Pre, 22.12 -0010-09-15T04:44:23 = Sht, 15.9 MMdd (MM-dd) 2008-02-05T18:30:30 = 02-05 1995-12-22T09:05:02 = 12-22 -0010-09-15T04:44:23 = 09-15 MMM (LLL) 2008-02-05T18:30:30 = Shk 1995-12-22T09:05:02 = Dhj -0010-09-15T04:44:23 = Sht MMMd (d MMM) 2008-02-05T18:30:30 = 5 Shk 1995-12-22T09:05:02 = 22 Dhj -0010-09-15T04:44:23 = 15 Sht MMMEd (E d MMM) 2008-02-05T18:30:30 = Mar 5 Shk 1995-12-22T09:05:02 = Pre 22 Dhj -0010-09-15T04:44:23 = Sht 15 Sht MMMMd (d MMMM) 2008-02-05T18:30:30 = 5 shkurt 1995-12-22T09:05:02 = 22 dhjetor -0010-09-15T04:44:23 = 15 shtator MMMMdd (dd MMMM) 2008-02-05T18:30:30 = 05 shkurt 1995-12-22T09:05:02 = 22 dhjetor -0010-09-15T04:44:23 = 15 shtator MMMMEd (E d MMMM) 2008-02-05T18:30:30 = Mar 5 shkurt 1995-12-22T09:05:02 = Pre 22 dhjetor -0010-09-15T04:44:23 = Sht 15 shtator 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 = Pre, 22.12.1995 -0010-09-15T04:44:23 = Sht, 15.9.-010 yMMM (MMM y) 2008-02-05T18:30:30 = Shk 2008 1995-12-22T09:05:02 = Dhj 1995 -0010-09-15T04:44:23 = Sht -10 yMMMEd (d MMM y) 2008-02-05T18:30:30 = 5 Shk 2008 1995-12-22T09:05:02 = 22 Dhj 1995 -0010-09-15T04:44:23 = 15 Sht -10 yMMMM (MMMM y) 2008-02-05T18:30:30 = shkurt 2008 1995-12-22T09:05:02 = dhjetor 1995 -0010-09-15T04:44:23 = shtator -10 yQ (y Q) 2008-02-05T18:30:30 = 2008 1 1995-12-22T09:05:02 = 1995 4 -0010-09-15T04:44:23 = -10 3 yQQQ (y QQQ) 2008-02-05T18:30:30 = 2008 Q1 1995-12-22T09:05:02 = 1995 Q4 -0010-09-15T04:44:23 = -10 Q3 yyQ (Q yy) 2008-02-05T18:30:30 = 1 08 1995-12-22T09:05:02 = 4 95 -0010-09-15T04:44:23 = 3 -10 yyyyMM (yyyy-MM) 2008-02-05T18:30:30 = 2008-02 1995-12-22T09:05:02 = 1995-12 -0010-09-15T04:44:23 = -010-09 yyyyMMMM (MMMM y) 2008-02-05T18:30:30 = shkurt 2008 1995-12-22T09:05:02 = dhjetor 1995 -0010-09-15T04:44:23 = shtator -10 Miscellaneous Prefers 24 hour time? No Local first day of the week e heenee 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::sq(3)
All times are GMT -4. The time now is 04:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy