Sponsored Content
Top Forums Shell Programming and Scripting Grabbing lines out of a file based on a date Post 302079911 by bsp18974 on Thursday 13th of July 2006 04:13:15 PM
Old 07-13-2006
Grabbing lines out of a file based on a date

Hello,

I'm new to this forum and am not exactly sure where to post this question, so I'll start here. I'm looking for a command or simple script that will read in a large flat file (contains 2005 data) and will output a new file based on a quarter. Within each row, position 87-90 is a julian date with values 5001 thru 5365. If I want 4th quarter data, all rows with a date of 5274 thru 5365 should be written into a new file. What's the easiest way to accomplish this?

Thanks,
Brian
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Quick question on grep: grabbing lines above and below

Just a quick question on grep/egrep. I am writing a shell script that is looking for certain strings in a text file. It works well and gets exactly what I need. However, the way the program writes to the text file, it puts the timestamp in a line above the string I am looking for and the path... (3 Replies)
Discussion started by: thecoffeeguy
3 Replies

2. Shell Programming and Scripting

Grabbing lines from one file based on another file

Hi everyone, I have a file that contains multiple columns. Basically the identifiers are on column 1. Here is an example: target1 6.7 8.4 target2 5.3 2.3 target3 4.3 2.3My goal is to pull out certain identifiers from column 1 (pull the entire row) and put it into another file. The... (4 Replies)
Discussion started by: gisele_l
4 Replies

3. Shell Programming and Scripting

Split the file based on date value

Hi frnds, I have flat file as . Say : output-file1.txt Output-file2.txt (1 Reply)
Discussion started by: Gopal_Engg
1 Replies

4. UNIX for Dummies Questions & Answers

Delete lines with duplicate strings based on date

Hey all, a relative bash/script newbie trying solve a problem. I've got a text file with lots of lines that I've been able to clean up and format with awk/sed/cut, but now I'd like to remove the lines with duplicate usernames based on time stamp. Here's what the data looks like 2007-11-03... (3 Replies)
Discussion started by: mattv
3 Replies

5. UNIX for Dummies Questions & Answers

Truncating file based on date

Hi, I need to truncate a file based on date.Suppose i have a log file which is getting updated every date,i need to keep 7 days worth of data(like sysdate-7) and rest i want to truncate it.Can some help me? (5 Replies)
Discussion started by: Param0073
5 Replies

6. Shell Programming and Scripting

Extracting specific lines of data from a file and related lines of data based on a grep value range?

Hi, I have one file, say file 1, that has data like below where 19900107 is the date, 19900107 12 144 129 0.7380047 19900108 12 168 129 0.3149017 19900109 12 192 129 3.2766666E-02 ... (3 Replies)
Discussion started by: Wynner
3 Replies

7. Shell Programming and Scripting

Script to determine Date,TotalFile,total size of file based on date

I have file listed like below -rw-r--r--+ 1 test test 17M Nov 26 14:43 test1.gz -rw-r--r--+ 1 test test 0 Nov 26 14:44 test2.gz -rw-r--r--+ 1 test test 0 Nov 27 10:41 test3.gz -rw-r--r--+ 1 test test 244K Nov 27 10:41 test4.gz -rw-r--r--+ 1 test test 17M Nov 27 10:41 test5.gz I... (5 Replies)
Discussion started by: krish2014
5 Replies

8. HP-UX

HP/UX command to pull file name/date based on date

HI, Can anyone tell me how to pull the date and file name separated by a space using the find command or any other command. I want to look through several directories and based on a date timeframe (find -mtime -7), output the file name (without the path) and the date(in format mmddyyyy) to a... (2 Replies)
Discussion started by: lnemitz
2 Replies

9. Post Here to Contact Site Administrators and Moderators

Read file name based on date

Hi, I have file name as Example extract_ces_v3_p044444rlt_20160514045705.txt.pgp extract_ces_v3_p044444rlt_20160614049705.txt.pgp extract_ces_v3_p044444rlt_20160714046705.txt.pgp I have to read file name based on date(i.e) files with same date and copy to another directory in shell script.... (3 Replies)
Discussion started by: caba_jones
3 Replies

10. Shell Programming and Scripting

Grabbing text between two lines with shell variables.

I would like to grab complex html text between lines using variables. I am running Debian and using mksh shell. Here is the part of the html that I want to extract from. I would like to extract the words 'to love,' and I would like to use the above and below lines as reference points. ... (3 Replies)
Discussion started by: bedtime
3 Replies
Finance::QuoteHist(3pm) 				User Contributed Perl Documentation				   Finance::QuoteHist(3pm)

NAME
Finance::QuoteHist - Perl module for fetching historical stock quotes. SYNOPSIS
use Finance::QuoteHist; $q = Finance::QuoteHist->new ( symbols => [qw(IBM UPS AMZN)], start_date => '01/01/2009', # or '1 year ago', see Date::Manip end_date => 'today', ); # Quotes 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; } # Culprit $fetch_class = $q->quote_source('IBM'); DESCRIPTION
Finance::QuoteHist is a top level interface for fetching historical stock quotes from the web. It is actually a front end to modules based on Finance::QuoteHist::Generic, the main difference being that it has a default lineup of web sites from which to attempt quote retrieval. If the prospect of mixing data from multiple sites seems scary to you, then use one of the site-specific modules directly. Unless otherwise defined via the lineup attribute, this module will select a lineup for you, the default being: Finance::QutoeHist::Yahoo Finance::QutoeHist::Google Finance::QuoteHist::QuoteMedia Finance::QutoeHist::MSN Once instantiated, this module behaves identically to the first module in the lineup, sharing all of that module's methods. Most queries will likely be handled by the first module in the lineup. If the site is down for some reason, or perhaps that site does not provide quotes for defunct ticker symbols, then the other sites in the lineup will be attempted. See Finance::QuoteHist::Generic(3) for gory details on all of the parameters and methods this module accepts. The basic interface is noted below. METHODS
The basic user interface consists of several 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. Optionally, if non-adjusted values were requested, their will be an extra element at the end of the row for the Adjusted closing price. dividends() Returns a list of rows (or a reference to an array containing those rows, if in scalar context). Each row contains the 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 Date, Post split shares, and Pre split shares, in that order. source($ticker, $target) Each of these methods displays which site-specific class actually retrieved the information, if any, for a particular ticker symbol and target such as 'quote' (default), 'dividend', or 'split'. 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. See the documentation for each site-specific module for more information regarding the disclaimer for that site. AUTHOR
Matthew P. Sisk, <sisk@mojotoad.com> COPYRIGHT
Copyright (c) 2000-2011 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::Yahoo(3), Finance::QuoteHist::QuoteMedia(3), perl(1). perl v5.12.4 2011-08-29 Finance::QuoteHist(3pm)
All times are GMT -4. The time now is 12:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy