Sponsored Content
Top Forums Shell Programming and Scripting Perl for comparing numbers from previous lines in a file? Post 302876309 by lucshi09 on Friday 22nd of November 2013 07:33:40 PM
Old 11-22-2013
This works great... thanks Chubler!!
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

comparing numbers in a file

Hello, I'm searching for a quick method to read numeric values from a file or a defined variable and identifying the largest number. For instance if the following numbers are in a file or defined to a variable: 09192007 09202007 09182007 09172007 09162007 What "short" method could be used to... (7 Replies)
Discussion started by: dusk2dawn
7 Replies

2. Shell Programming and Scripting

Perl how to move pointer to previous line in a txt file?

I have a text file that has blocks of text. Each block starts with ### and ends with End_###. I wrote a perl script to search a string from line 2 (ignore any line starts with ###) of each block if matched, need to print that whole block. According to the input file in below, it will print... (5 Replies)
Discussion started by: tqlam
5 Replies

3. Shell Programming and Scripting

Search for a pattern in a file and print previous lines from a particular point

Hi, I am new to ksh scripting and I have a problem. I have a file in which I have to search for a particular pattern say 'a' then from that line I need to search for another pattern say 'b' in the previous lines and thne print the file from pattern 'b' till the end of file. For eg: ... (2 Replies)
Discussion started by: umaislearning
2 Replies

4. Shell Programming and Scripting

comparing lines in file

i have 2 files and i want to compare i currently cat the files and awk print $1, $2 and doing if file1=file2 then fail, else exit 0 what i want to do is compare values, with column 1 being a reference i want to compare line by line and then still be able to do if then statement to see if worked... (1 Reply)
Discussion started by: sigh2010
1 Replies

5. Shell Programming and Scripting

Finding lines matching the Pattern and their previous lines in a file

Hi, I am trying to locate the occurences of certain pattern like 'Possible network disconnect' in a text file. I can get the actual lines matching the pttern using: grep -w 'Possible network disconnect' file_name. But I am more interested in getting the timing of these events which are... (7 Replies)
Discussion started by: sagarparadkar
7 Replies

6. Shell Programming and Scripting

ksh comparing current and previous lines

Hi, I am currently trying to work out how to compare one line with the last line I have read in via ksh. I have a file which has sorted output from a previous sort command so all the lines are in order already and the file would look something like show below. Each line has a name and a time... (5 Replies)
Discussion started by: paulie
5 Replies

7. Shell Programming and Scripting

grep lines from the previous day's file

I have files called printfile.log.1121, printfile.log.1122, etc where 1121 and 1122 are the date of the file creation. The file contents are like: ================================================================================ User = d_prod Env = d_prod Dir =... (3 Replies)
Discussion started by: Daniel Gate
3 Replies

8. Linux

Perl program to print previous set of lines once a pattern is matched

Hi all, I have a text data file. My aim here is to find line called *FIELD* AV for every record and print lines after that till *FIELD* RF. But here I want first 3 to four lines for very record as well. FIELD AV is some where in between for very record. SO I am not sure how to retrieve lines in... (2 Replies)
Discussion started by: kaav06
2 Replies

9. Shell Programming and Scripting

Remove previous line if next & previous lines have same 4th character.

I want to remove commands having no output. In below text file. bash-3.2$ cat abc_do_it.txt grpg10so>show trunk group all status grpg11so>show trunk group all status grpg12so>show trunk group all status GCPKNYAIGT73IMO 1440 1345 0 0 94 0 0 INSERVICE 93% 0%... (4 Replies)
Discussion started by: Raza Ali
4 Replies

10. Shell Programming and Scripting

Comparing two files with numbers and taking difference in third file

Hi All, I have two files in the following format, with numbers being defined under columns(described by a set of headers) and rows(again defined by a set of identifiers) 2013 2013 Make200 Make201 Merc BMW Jpur Del ... (9 Replies)
Discussion started by: dev.devil.1983
9 Replies
Weather::Com::CurrentConditions(3pm)			User Contributed Perl Documentation		      Weather::Com::CurrentConditions(3pm)

NAME
Weather::Com::CurrentConditions - class containing current weather conditions SYNOPSIS
#!/usr/bin/perl -w use Weather::Com::Finder; # you have to fill in your ids from weather.com here my $PartnerId = 'somepartnerid'; my $LicenseKey = 'mylicense'; my %weatherargs = ( 'partner_id' => $PartnerId, 'license' => $LicenseKey, 'language' => 'de', ); my $finder = Weather::Com::Finder->new(%weatherargs); # if you want an array of locations: my @locations = $finder->find('Heidelberg'); my $conditions = $locations[0]->current_conditions(); print "Found weather for city: ", $location->name(), " "; print "Current conditions are ", $conditions->description(), " "; print "Current temperature is ", $conditions->temperature(), "oC "; print "... as found out by observatory ", $conditions->observatory(), " "; DESCRIPTION
Using Weather::Com::CurrentCondition objects provide current weather conditions of its parent object (a location) to you. You get Weather::Com::CurrentConditions objects by calling the method "current_conditions()" of your location object. Weather::Com::CurrentConditions is a subclass of Weather::Com::Cached. An instance of this class will update itself corresponding to the caching rules any time one of its methods is called. CONSTRUCTOR
new(hash or hashref) The constructor will usually not be used directly because you get a ready to use current conditions objects from your location object. If you ever want to instantiate current conditions objects on your own, you have to provide the same configuration hash or hashref to the constructor you usually would provide to the "new()" method of Weather::Com::Finder. In addition it is necessary to add a hash element "location_id" to this config hash. The "location_id" has to be a valid weather.com location id. METHODS
id() Returns the location id used to instantiate this object. name() Returns the name of the location this current conditions belong to. description([$language]) Returns a textual representation of the current weather conditions. This description is translated if you specified the language option as argument for your Weather::Com::Finder. This attribute is dynamic language enabled. dewpoint() Returns the dewpoint. humidity() Returns the humidity (in %). icon() Returns the number of the icon that can be used to display the current weather conditions. These icons are available with the weather.com sdk. You can download this sdk from weather.com after you've registered to get your license. last_updated() Returns a Weather::Com::DateTime object containing the date and time of the last update as provided by weather.com. observatory() Returns the name of the observatory that provided the current conditions to weather.com. pressure() Returns a Weather::Com::AirPressure object. Please refer to Weather::Com::AirPressure for further details. temperature() Returns the temperature (depending on how you instantiated your Weather::Com::Finder you'll get centigrade (default) or degrees fahren- heit). uv_index() Returns a Weather::Com::UVIndex object. Please refer to Weather::Com::UVIndex for further details. visibility() Returns the visibility (depending on how you instantiated your Weather::Com::Finder you'll get km (default) or miles). wind() Returns a Weather::Com::Wind object. Please refer to Weather::Com::Wind for further details. windchill() Returns the windchill temperature (depending on how you instantiated your Weather::Com::Finder you'll get centigrade (default) or degrees fahrenheit). SEE ALSO
See also documentation of Weather::Com, Weather::Com::CurrentConditions, Weather::Com::Units. AUTHOR
Thomas Schnuecker, <thomas@schnuecker.de> COPYRIGHT AND LICENSE
Copyright (C) 2004-2007 by Thomas Schnuecker This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. The data provided by weather.com and made accessible by this OO interface can be used for free under special terms. Please have a look at the application programming guide of weather.com (http://www.weather.com/services/xmloap.html) perl v5.8.8 2007-07-09 Weather::Com::CurrentConditions(3pm)
All times are GMT -4. The time now is 02:25 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy