Sponsored Content
Top Forums Shell Programming and Scripting Extract the lines between two dates Post 302666739 by elixir_sinari on Thursday 5th of July 2012 05:28:21 AM
Old 07-05-2012
Code:
strt='2012-07-01 19:15:01'
end='2012-07-01 19:30:01'
awk '/'"$strt"'/{p=1;next} /'"$end"'/{p=0}p' inputfile

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Subtract two dates in different lines

Hi Friends :) I have a long file having fields in the form : Field1 yy/mm/dd hh:mm:ss Duration(Sec) line 1) 123123 05/11/30 12:12:56 145 line 2) 145235 05/11/30 12:15:15 30 line 3) 145264 05/11/30 13:14:56 178 . . I want to... (1 Reply)
Discussion started by: vanand420
1 Replies

2. Shell Programming and Scripting

Need script to generate all the dates in DDMMYY format between 2 dates

Hello friends, I am looking for a script or method that can display all the dates between any 2 given dates. Input: Date 1 290109 Date 2 010209 Output: 300109 310109 Please help me. Thanks. :):confused: (2 Replies)
Discussion started by: frozensmilz
2 Replies

3. Shell Programming and Scripting

data extract from dates

I have a 1 GB file.I want to take the information for last one month from that file. Say i want to extract data from May 1st. File contents below. 193.135.218.124 - - "GET /jsp/acafai/supplier/notification.htm HTTP/1.1" 200 38531 193.135.218.124 - - "GET /images/2_aca_fai.gif HTTP/1.1"... (5 Replies)
Discussion started by: Krrishv
5 Replies

4. Shell Programming and Scripting

Extract loglines between two dates

Hi all, this is my first post, and i want to say hello to everyone in there. I've a little problem for you all :). I have a log like this: 38714 07/02/09 00:01:36 nsrd web2consolidato:D:\ done saving to pool 'SISTMSW0060' (Q09480) 32 GB 38752 07/02/09 00:01:37 nsrd /dev/rmt/STK0.2.10.5... (5 Replies)
Discussion started by: koma
5 Replies

5. UNIX for Dummies Questions & Answers

Extract dates from file name.

Hi All, I have files with names as us_Gec1_wk_01to01_2008.TXT ad_EngEnt_wk_01to10_2008.TXT br_EngMov_wk_01to10_2008.TXT Over here, I need to extract the dates and the year and store them in variables. How can I achieve the same in bash. In case of ad_EngEnt_wk_01to10_2008.TXT ... (3 Replies)
Discussion started by: Swapna173
3 Replies

6. Shell Programming and Scripting

lines between two dates in a file

Hi Every body I had a data in file as shown.. Now i want to get the data and insert into other file but between the two date ranges or from a past date to current date..Please Guide me in doing that.. Below is the data that looks like... child process 2588 still did not exit, sending a... (2 Replies)
Discussion started by: Reddy482
2 Replies

7. UNIX for Dummies Questions & Answers

Extract lines with specific words with addition 2 lines before and after

Dear all, Greetings. I would like to ask for your help to extract lines with specific words in addition 2 lines before and after these lines by using awk or sed. For example, the input file is: 1 ak1 abc1.0 1 ak2 abc1.0 1 ak3 abc1.0 1 ak4 abc1.0 1 ak5 abc1.1 1 ak6 abc1.1 1 ak7... (7 Replies)
Discussion started by: Amanda Low
7 Replies

8. Shell Programming and Scripting

Search for a pattern,extract value(s) from next line, extract lines having those extracted value(s)

I have hundreds of files to process. In each file I need to look for a pattern then extract value(s) from next line and then search for value(s) selected from point (2) in the same file at a specific position. HEADER ELECTRON TRANSPORT 18-MAR-98 1A7V TITLE CYTOCHROME... (7 Replies)
Discussion started by: AshwaniSharma09
7 Replies

9. Shell Programming and Scripting

ksh sed - Extract specific lines with mulitple occurance of interesting lines

Data file example I look for primary and * to isolate the interesting slot number. slot=`sed '/^primary$/,/\*/!d' filename | tail -1 | sed s'/*//' | awk '{print $1" "$2}'` Now I want to get the Touch line for only the associate slot number, in this case, because the asterisk... (2 Replies)
Discussion started by: popeye
2 Replies

10. Shell Programming and Scripting

awk - printing new lines based of 2 dates

I have some test data that is seperated out into annual records, each record has a start date (COL7), an end date (COL8) and a maturity date (COL18) - What I need to do is ensure that there is one record to cover each year right up until Maturity date (COL18). In the first group of the below... (10 Replies)
Discussion started by: Ads89
10 Replies
DP(8)                                                                [nmh-1.5]                                                               DP(8)

NAME
dp - parse dates 822-style SYNOPSIS
/usr/lib/mh/dp [-form formatfile] [-format string] [-width columns] [-version] [-help] dates ... DESCRIPTION
Dp is a program that parses dates according to the ARPA Internet standard. It also understands many non-standard formats, such as those produced by TOPS-20 sites and some UNIX sites using ctime(3). It is useful for seeing how nmh will interpret a date. The dp program treats each argument as a single date, and prints the date out in the official 822-format. Hence, it is usually best to enclose each argument in quotes for the shell. To override the output format used by dp, the -format string or -format file switches are used. This permits individual fields of the address to be extracted with ease. The string is simply a format string and the file is simply a format file. See mh-format(5) for the details. Here is the default format string used by dp: %<(nodate{text})error: %{text}%|%(putstr(pretty{text}))%> which says that if an error was detected, print the error, a `:', and the date in error. Otherwise, output the 822-proper format of the date. FILES
$HOME/.mh_profile The user profile PROFILE COMPONENTS
None SEE ALSO
ap(8), Standard for the Format of ARPA Internet Text Messages (RFC-822) DEFAULTS
`-format' default as described above `-width' default to the width of the terminal CONTEXT
None BUGS
The argument to the -format switch must be interpreted as a single token by the shell that invokes dp. Therefore, one must usually place the argument to this switch inside quotes. MH.6.8 11 June 2012 DP(8)
All times are GMT -4. The time now is 04:30 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy