Sponsored Content
Top Forums Shell Programming and Scripting File name from a List of files Post 302564207 by bhargav_k on Thursday 13th of October 2011 06:06:34 AM
Old 10-13-2011
Code:
Validating address (getting geocode) of subscriber in OTSM... ",56241257,America/Chicago,false
INSERT,p3wtg1z2.edc.cingular.net,1318483203,131,2011/10/13 00:20:03.0131 (America/Chicago),Scheduler0,1620,257019,DEBUG2,,DEB
UG_LEVEL2,"Lb_OTSMCreateUserPasswordHeader::UserPasswordHeaderAVS->AVS::OTSM_UserPasswordHeader
UserName(STRING) -> m70991
Password(STRING) -> ykGus2jG
",56241257,America/Chicago,false
INSERT,p3wtg1z2.edc.cingular.net,1318483203,131,2011/10/13 00:20:03.0131 (America/Chicago),Scheduler0,1620,257020,DEBUG1,,DEB
UG_LEVEL1,"Lb_OTSMSendValidateAddressRequest::
Auto Renew Purchase scheduler started with entityId... 26359230_3",578918291,America/Chicago,false
INSERT,p3wtg1z2.edc.cingular.net,1318485495,26,2011/10/13 00:58:15.0026 (America/Chicago),Scheduler0,1620,257374,DEBUG1,,DEBU
G_LEVEL1,"Lb_CPMGetOrderPlan::Getting order plan (26359230)",,America/Chicago,false

When I grep INSERT, the above will be redirected from multiple log files under a directory.

But, out of 50 files, I'm confused from which all files, this entry is made to the temp file.

---------- Post updated at 05:06 AM ---------- Previous update was at 04:40 AM ----------

I realize that I was trying to get the file name after It is being redirected.

1. Redirect the log between start and end time to a temp file
2. Grep the temp file for string and redirect to error file

I was trying to get the file name from where the string is captured at step 2. Where in it should be captured at step 1 itself.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

filesize from a file which has the list of files.

i have a file myfile. it has the below entries /temp/firstfile /temp/secondfile and many more.. okay, now, i want to addup all the space occupied by this file hmmm, but i met with a problem in getting each file out. i did a silly command like more myfile | grep temp | ls -ltr and it... (3 Replies)
Discussion started by: yls177
3 Replies

2. UNIX for Dummies Questions & Answers

how to list the files using File Descriptors

hello, I have written a script named listall.sh with the following codes init. #!/bin/bash PATH="/proj/cmon/$1" echo $PATH if ; then echo "Usage: $0 ***" exit 1 else ls -l $PATH/*.sc fi Here there are 3 subdirectories (namely - src, data and jobs)under /proj/cmon, so... (2 Replies)
Discussion started by: shyjuezy
2 Replies

3. Shell Programming and Scripting

ls > file - Creating file containing the list of all files present in a directory

Hi All, I need to create a file which contains the list of all the files present in that directory. e.g., ls /export/home/user/*.dat > list_file.dat but what i am getting is: $ ls /export/home/user/*.dat > list_file.dat /export/home/user/*.dat: No such file or directory But I have... (1 Reply)
Discussion started by: pranavagarwal
1 Replies

4. Shell Programming and Scripting

List the file or files with last modification date

hi. I need help my programing friends :p I need to list all the files with a certain name (for example FileName) by last modification date but only the one with the last date. If there are two files with the same name and same modification date it should print the both. For example in this set... (6 Replies)
Discussion started by: KitFisto
6 Replies

5. Shell Programming and Scripting

Delete old files but with exclusion with file list

Hello Can you please help and check what im missing on script below the goal is to delete the old files more than 7 days old but not the excluded file list inside excluded.dat file #!/bin/sh EXCLUDE=/path/to/exclude/exclude.dat FIND=/bin/find for xfile in '(read $EXCLUDE)' do $FIND... (9 Replies)
Discussion started by: angst_nu
9 Replies

6. Shell Programming and Scripting

Take a list if strings from a file and search them in a list of files and report them

I have a file 1.txt with the below contents. -----cat 1.txt----- 1234 5678 1256 1234 1247 ------------------- I have 3 more files in a folder -----ls -lrt------- A1.txt A2.txt A3.txt ------------------- The contents of those three files are similar format with different data values... (8 Replies)
Discussion started by: realspirituals
8 Replies

7. Shell Programming and Scripting

File that Contains a List of Files

I have a first text file (LoopFiles.txt) that contains another list of text files. I need to run NAWK commands on each of the files that are listed in the first text file. I have proven the existence of the first file with ls -l But I get a message that my first file doesnt exist. cd... (5 Replies)
Discussion started by: he204035
5 Replies

8. Shell Programming and Scripting

How to list files that are not first two files date & last file date for every month-year?

Hi All, I need to find all files other than first two files dates & last file date for month and month/year wise list. lets say there are following files in directory Mar 19 2012 c.txt Mar 19 2012 cc.txt Mar 21 2012 d.txt Mar 22 2012 f.txt Mar 24 2012 h.txt Mar 25 2012 w.txt Feb 12... (2 Replies)
Discussion started by: Makarand Dodmis
2 Replies

9. Shell Programming and Scripting

While loop a file containing list of file names until the files are found?

Hi, I have a control file which will contain all filenames(300) files. Loop through all the file names in the control files and check the existence of this file in another directory(same server). I need to infinitely(2 hrs) run this while loop until all the files are found. Once a file is found,... (5 Replies)
Discussion started by: laknar
5 Replies

10. Shell Programming and Scripting

List dublicated files into a file

Dear All, I have many files in a directory similar in below format (in order to understand each group files are separated from others by blank lines ). I want to find duplicate filenames and write them into a new file line by line. I tried several scripts but I couldn't be successful. Do... (9 Replies)
Discussion started by: bulpak
9 Replies
DateTime::TimeZone(3)					User Contributed Perl Documentation				     DateTime::TimeZone(3)

NAME
DateTime::TimeZone - Time zone object base class and factory VERSION
version 1.63 SYNOPSIS
use DateTime; use DateTime::TimeZone; my $tz = DateTime::TimeZone->new( name => 'America/Chicago' ); my $dt = DateTime->now(); my $offset = $tz->offset_for_datetime($dt); DESCRIPTION
This class is the base class for all time zone objects. A time zone is represented internally as a set of observances, each of which describes the offset from GMT for a given time period. Note that without the "DateTime.pm" module, this module does not do much. It's primary interface is through a "DateTime" object, and most users will not need to directly use "DateTime::TimeZone" methods. USAGE
This class has the following methods: DateTime::TimeZone->new( name => $tz_name ) Given a valid time zone name, this method returns a new time zone blessed into the appropriate subclass. Subclasses are named for the given time zone, so that the time zone "America/Chicago" is the DateTime::TimeZone::America::Chicago class. If the name given is a "link" name in the Olson database, the object created may have a different name. For example, there is a link from the old "EST5EDT" name to "America/New_York". When loading a time zone from the Olson database, the constructor checks the version of the loaded class to make sure it matches the version of the current DateTime::TimeZone installation. If they do not match it will issue a warning. This is useful because time zone names may fall out of use, but you may have an old module file installed for that time zone. There are also several special values that can be given as names. If the "name" parameter is "floating", then a "DateTime::TimeZone::Floating" object is returned. A floating time zone does have any offset, and is always the same time. This is useful for calendaring applications, which may need to specify that a given event happens at the same local time, regardless of where it occurs. See RFC 2445 for more details. If the "name" parameter is "UTC", then a "DateTime::TimeZone::UTC" object is returned. If the "name" is an offset string, it is converted to a number, and a "DateTime::TimeZone::OffsetOnly" object is returned. The "local" time zone If the "name" parameter is "local", then the module attempts to determine the local time zone for the system. The method for finding the local zone varies by operating system. See the appropriate module for details of how we check for the local time zone. o DateTime::TimeZone::Local::Unix o DateTime::TimeZone::Local::Win32 o DateTime::TimeZone::Local::VMS If a local time zone is not found, then an exception will be thrown. $tz->offset_for_datetime( $dt ) Given a "DateTime" object, this method returns the offset in seconds for the given datetime. This takes into account historical time zone information, as well as Daylight Saving Time. The offset is determined by looking at the object's UTC Rata Die days and seconds. $tz->offset_for_local_datetime( $dt ) Given a "DateTime" object, this method returns the offset in seconds for the given datetime. Unlike the previous method, this method uses the local time's Rata Die days and seconds. This should only be done when the corresponding UTC time is not yet known, because local times can be ambiguous due to Daylight Saving Time rules. $tz->is_dst_for_datetime( $dt ) Given a "DateTime" object, this method returns true if the DateTime is currently in Daylight Saving Time. $tz->name Returns the name of the time zone. $tz->short_name_for_datetime( $dt ) Given a "DateTime" object, this method returns the "short name" for the current observance and rule this datetime is in. These are names like "EST", "GMT", etc. It is strongly recommended that you do not rely on these names for anything other than display. These names are not official, and many of them are simply the invention of the Olson database maintainers. Moreover, these names are not unique. For example, there is an "EST" at both -0500 and +1000/+1100. $tz->is_floating Returns a boolean indicating whether or not this object represents a floating time zone, as defined by RFC 2445. $tz->is_utc Indicates whether or not this object represents the UTC (GMT) time zone. $tz->has_dst_changes Indicates whether or not this zone has ever had a change to and from DST, either in the past or future. $tz->is_olson Returns true if the time zone is a named time zone from the Olson database. $tz->category Returns the part of the time zone name before the first slash. For example, the "America/Chicago" time zone would return "America". DateTime::TimeZone->is_valid_name($name) Given a string, this method returns a boolean value indicating whether or not the string is a valid time zone name. If you are using "DateTime::TimeZone::Alias", any aliases you've created will be valid. DateTime::TimeZone->all_names This returns a pre-sorted list of all the time zone names. This list does not include link names. In scalar context, it returns an array reference, while in list context it returns an array. DateTime::TimeZone->categories This returns a list of all time zone categories. In scalar context, it returns an array reference, while in list context it returns an array. DateTime::TimeZone->links This returns a hash of all time zone links, where the keys are the old, deprecated names, and the values are the new names. In scalar context, it returns a hash reference, while in list context it returns a hash. DateTime::TimeZone->names_in_category( $category ) Given a valid category, this method returns a list of the names in that category, without the category portion. So the list for the "America" category would include the strings "Chicago", "Kentucky/Monticello", and "New_York". In scalar context, it returns an array reference, while in list context it returns an array. DateTime::TimeZone->countries() Returns a sorted list of all the valid country codes (in lower-case) which can be passed to "names_in_country()". In scalar context, it returns an array reference, while in list context it returns an array. If you need to convert country codes to names or vice versa you can use "Locale::Country" to do so. DateTime::TimeZone->names_in_country( $country_code ) Given a two-letter ISO3166 country code, this method returns a list of time zones used in that country. The country code may be of any case. In scalar context, it returns an array reference, while in list context it returns an array. This list is returned in an order vaguely based on geography and population. In general, the least used zones come last, but there are not guarantees of a specific order from one release to the next. This order is probably the best option for presenting zones names to end users. DateTime::TimeZone->offset_as_seconds( $offset ) Given an offset as a string, this returns the number of seconds represented by the offset as a positive or negative number. Returns "undef" if $offset is not in the range "-99:59:59" to "+99:59:59". The offset is expected to match either "/^([+-])?(dd?):(dd)(?::(dd))?$/" or "/^([+-])?(dd)(dd)(dd)?$/". If it doesn't match either of these, "undef" will be returned. This means that if you want to specify hours as a single digit, then each element of the offset must be separated by a colon (:). DateTime::TimeZone->offset_as_string( $offset ) Given an offset as a number, this returns the offset as a string. Returns "undef" if $offset is not in the range "-359999" to 359999. Storable Hooks This module provides freeze and thaw hooks for "Storable" so that the huge data structures for Olson time zones are not actually stored in the serialized structure. If you subclass "DateTime::TimeZone", you will inherit its hooks, which may not work for your module, so please test the interaction of your module with Storable. SUPPORT
Support for this module is provided via the datetime@perl.org email list. See http://datetime.perl.org/wiki/datetime/page/Mailing_List for details. Please submit bugs to the CPAN RT system at http://rt.cpan.org/NoAuth/ReportBug.html?Queue=datetime%3A%3Atimezone or via email at bug-datetime-timezone@rt.cpan.org. DONATIONS
If you'd like to thank me for the work I've done on this module, please consider making a "donation" to me via PayPal. I spend a lot of free time creating free software, and would appreciate any support you'd care to offer. Please note that I am not suggesting that you must do this in order for me to continue working on this particular software. I will continue to do so, inasmuch as I have in the past, for as long as it interests me. Similarly, a donation made in this way will probably not make me work on this software much more, unless I get so many donations that I can consider working on free software full time, which seems unlikely at best. To donate, log into PayPal and send money to autarch@urth.org or use the button on this page: <http://www.urth.org/~autarch/fs-donation.html> CREDITS
This module was inspired by Jesse Vincent's work on Date::ICal::Timezone, and written with much help from the datetime@perl.org list. SEE ALSO
datetime@perl.org mailing list http://datetime.perl.org/ The tools directory of the DateTime::TimeZone distribution includes two scripts that may be of interest to some people. They are parse_olson and tests_from_zdump. Please run them with the --help flag to see what they can be used for. AUTHOR
Dave Rolsky <autarch@urth.org> COPYRIGHT AND LICENSE
This software is copyright (c) 2013 by Dave Rolsky. This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. perl v5.18.2 2013-10-28 DateTime::TimeZone(3)
All times are GMT -4. The time now is 03:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy