Sponsored Content
Top Forums Shell Programming and Scripting date-extraction from a file in KSH Post 302071370 by homer_hn on Wednesday 19th of April 2006 01:38:51 AM
Old 04-19-2006
date-extraction from a file in KSH

Hi, everyone,
Now I have a ".csv" file and I want to extract a string-like date value from the file, say, it is in the 2nd row of the file and it is in the fixed context like:
"
This is the file title, //Row 1
The lastest update happened on: 10-Mar-2006 //Row2
....//other irrelavent rows
"
I want to use KSH script to extract this value "10-Mar-2006", and also, I will need to write this value to a certain fixed place in another file,say,"updateRecord.txt", and it is in the context like:
"
This file is to record the lastest update time, //row 1
The latest update time is: _________ (I want to put the value extracted from source file to be here) //row2
//.....other rows
"
Anyone can provide any tips for me? Thanks a lot for ur help

Rgds
HN
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

help on file extraction

Hello, Im trying to extract a portion of a big file. Using unique pattern /occurrence , (ex. loginname1,logoff and loginname2,logoff ), I like to print the lines that contain the patterns and the lines between them. Also, create a file for every login occurrence. Thanks for everyone's... (1 Reply)
Discussion started by: apalex
1 Replies

2. Shell Programming and Scripting

Report file extraction based on Date range

Hi all, Iam writing a script, which will extract all the files from Start_Date to End_Date. Files are date stamped as YYYYMMDD. For ex: Start_Date='20051001' End_Date='20060331' extract files such as........ ramp_20050810.rpt ramp_20050915.rpt ramp_20051001.rpt ramp_20051010.rpt... (2 Replies)
Discussion started by: ganapati
2 Replies

3. Shell Programming and Scripting

want to get previous date from date command in ksh

I want to get previous date from date command. I am using ksh shell. Exmp: today is 2008.09.04 I want the result : 2008.09.03 Please help. Thanks in advance. (4 Replies)
Discussion started by: rinku
4 Replies

4. Shell Programming and Scripting

Date and time range extraction via Awk or analysis script?

Hello does anyone know of an awk that will extract log file entries between a specific date and time range, eg: awk '/15\/Dec\/2010:16:10:00/, /15\/Dec\/2010:16:15:00/' access_log but one that works? Or a free command line log file analysis tool/script? I'd like to be able to view... (2 Replies)
Discussion started by: competitions
2 Replies

5. Shell Programming and Scripting

How to Get 60 days Old date from current date in KSH script

Hi i am writing a cron job. so for it i need the 60 days old date form current date in variable. Like today date is 27 jan 2011 then output value will be stote in variable in formet Nov 27. i am using EST date, and tried lot of solution and see lot of post but it did not helpful for me. so... (3 Replies)
Discussion started by: Himanshu_soni
3 Replies

6. Shell Programming and Scripting

File Extraction

Hi, I have three files as below: AA.DAT20110505063903.Z AA.DAT20110405062903.Z AA.DAT20110305061903.Z All the above files are appended with Date and timestamp in compressed format. I need to extract AA.DAT20110505063903.Z(which is the latest file) from one server and uncompress it... (2 Replies)
Discussion started by: pyaranoid
2 Replies

7. Shell Programming and Scripting

ksh compare dates INSIDE a file (ie date A is > date B)

In KSH, I am pasting 2 almost identical files together and each one has a date and time on each line. I need to determine if the first instance of the date/time is greater than the 2nd instance of the date/time. If the first instance is greater, I just need to echo that line. I thought I would... (4 Replies)
Discussion started by: right_coaster
4 Replies

8. UNIX for Dummies Questions & Answers

Unable to convert date into no. using date -d +%s syntax in ksh shell

hi friends, I m trying to write a script which compares to dates. for this i am converting dates into no using synatx as below v2=`date | awk '{print $2,$3,$4}'` v3=`date +%s -d "$v2"` this syntax is working in bash shell ,but fails in ksh shell. please suggest on this. (12 Replies)
Discussion started by: Jcpratap
12 Replies

9. Shell Programming and Scripting

FILE_ID extraction from file name and save it in CSV file after looping through each folders

FILE_ID extraction from file name and save it in CSV file after looping through each folders My files are located in UNIX Server, i want to extract file_id and file_name from each file .and save it in a CSV file. How do I do that? I have folders in unix environment, directory structure is... (15 Replies)
Discussion started by: princetd001
15 Replies

10. UNIX for Dummies Questions & Answers

Print start date to end date, given $1 & $2 in ksh

Dear all, I have an user passing 2 parameter 31/03/2015 and 02/04/2015 to a ksh script. How to print the start date to end date. Expected output is : 31/03/2015 01/04/2015 02/04/2015 Note : 1. Im using aix and ksh 2. I have tried to convert the given input into a date, didnt... (0 Replies)
Discussion started by: mr.rajaravi
0 Replies
Finance::QuoteHist::Yahoo(3pm)				User Contributed Perl Documentation			    Finance::QuoteHist::Yahoo(3pm)

NAME
Finance::QuoteHist::Yahoo - Site-specific subclass for retrieving historical stock quotes. SYNOPSIS
use Finance::QuoteHist::Yahoo; $q = new Finance::QuoteHist::Yahoo ( symbols => [qw(IBM UPS AMZN)], start_date => '01/01/2009', end_date => 'today', ); # Values foreach $row ($q->quotes()) { ($symbol, $date, $open, $high, $low, $close, $volume) = @$row; ... } # Splits foreach $row ($q->splits()) { ($symbol, $date, $post, $pre) = @$row; } # Dividends foreach $row ($q->dividends()) { ($symbol, $date, $dividend) = @$row; } DESCRIPTION
Finance::QuoteHist::Yahoo is a subclass of Finance::QuoteHist::Generic, specifically tailored to read historical quotes, dividends, and splits from the Yahoo web site (http://table.finance.yahoo.com/). For quotes and dividends, Yahoo can return data quickly in CSV format. Both of these can also be extracted from HTML tables. Splits are extracted from the HTML of the 'Basic Chart' page for that ticker. There are no date range restrictions on CSV queries for quotes and dividends. For HTML queries, Yahoo takes arbitrary date ranges as arguments, but breaks results into pages of 66 entries. Please see Finance::QuoteHist::Generic(3) for more details on usage and available methods. If you just want to get historical quotes and are not interested in the details of how it is done, check out Finance::QuoteHist(3). METHODS
The basic user interface consists of three methods, as seen in the example above. Those methods are: quotes() Returns a list of rows (or a reference to an array containing those rows, if in scalar context). Each row contains the Symbol, Date, Open, High, Low, Close, and Volume for that date. dividends() Returns a list of rows (or a reference to an array containing those rows, if in scalar context). Each row contains the Symbol, Date, and amount of the Dividend, in that order. splits() Returns a list of rows (or a reference to an array containing those rows, if in scalar context). Each row contains the Symbol, Date, Post split shares, and Pre split shares, in that order. The following methods override methods provided by the Finance::QuoteHist::Generic module; more of this was necessary than is typical for a basic query site due to the variety of query types and data formats available on Yahoo. url_maker() Returns a subroutine reference tailored for the current target mode and parsing mode. The routine is an iterator that will produce all necessary URLs on repeated invocations necessary to complete a query. extractors() Returns a hash of subroutine references that attempt to extract embedded values (dividends or splits) within the results from a larger query. labels() Includes the 'adj' column. REQUIRES
Finance::QuoteHist::Generic DISCLAIMER
The data returned from these modules is in no way guaranteed, nor are the developers responsible in any way for how this data (or lack thereof) is used. The interface is based on URLs and page layouts that might change at any time. Even though these modules are designed to be adaptive under these circumstances, they will at some point probably be unable to retrieve data unless fixed or provided with new parameters. Furthermore, the data from these web sites is usually not even guaranteed by the web sites themselves, and oftentimes is acquired elsewhere. If you would like to know more, check out the terms of service from Yahoo!, which can be found here: http://docs.yahoo.com/info/terms/ If you still have concerns, then use another site-specific historical quote instance, or none at all. Above all, play nice. AUTHOR
Matthew P. Sisk, <sisk@mojotoad.com> COPYRIGHT
Copyright (c) 2000-2010 Matthew P. Sisk. All rights reserved. All wrongs revenged. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. SEE ALSO
Finance::QuoteHist::Generic(3), Finance::QuoteHist(3), perl(1). perl v5.12.4 2010-09-20 Finance::QuoteHist::Yahoo(3pm)
All times are GMT -4. The time now is 11:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy