Sponsored Content
Top Forums Shell Programming and Scripting Delete lines in a file by date on the line Post 302488800 by fas1 on Tuesday 18th of January 2011 12:21:24 PM
Old 01-18-2011
Delete lines in a file by date on the line

Hi

I have a file with lines ending with a date in format dd/mm/yyyy see example below:
Code:
a|b|c|08/01/2011
d|a|e|31/11/2010
e|d|f|20/11/2010
f|s|r|18/01/2011

What I would like to do is delete all lines with a date older than 30 days.

With above example I should be left with a file like below
Code:
a|b|c|08/01/2011
f|s|r|18/01/2011

Smilie

Your help would be appreciated.

Thanks in advance.

Last edited by Scott; 01-18-2011 at 02:00 PM.. Reason: Code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete lines prior to a specific date in a log file.

Hi all. I have a database log file in which log data get appended to it daily. I want to do a automatic maintainence of this log by going through the log and deleting lines belonging to a certain date. How should i do it? Please help. Thanks. Example. To delete all lines prior to Jun... (4 Replies)
Discussion started by: ahSher
4 Replies

2. 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

3. Shell Programming and Scripting

Delete lines line by match data 2 file.

i need to delete the lines is match from file data 1 & data 2 please help? data 1 4825307 4825308 4825248 4825309 4825310 4825311 4825336 data 2 4825248 0100362210 Time4Meal 39.00 41.73 MO & MT MT SMS 4825305 0100367565... (2 Replies)
Discussion started by: ooilinlove
2 Replies

4. Shell Programming and Scripting

delete lines ! like date format

Vars $b=03, $a=Feb,$c=2011 & d=$b/$a/$c 2].task=AVPNetwork 200 4].workCategory=Req%20Loc 200 - 5].workCategory=Req%20Loc 30/Jan/2011 -- ... 31/Jan/2011 -- ... 01/Feb/2011 -- ... 02/Feb/2011 -- ... 03/Feb/2011 -- ... I'm trying to remove the garbage 2 lines at... (2 Replies)
Discussion started by: dba_frog
2 Replies

5. UNIX for Dummies Questions & Answers

Delete a row from a file if one column containing a date is greater than the current system date

Hello gurus, I am hoping someone can help me with the required code/script to make this work. I have the following file with records starting at line 4: NETW~US60~000000000013220694~002~~IT~USD~2.24~20110201~99991231~01~01~20101104~... (4 Replies)
Discussion started by: chumsky
4 Replies

6. Shell Programming and Scripting

How to delete several lines from file by line number?

Hi I am using the following command to delete a line from the file by line number: line_number=14 sed "${line_number}d" inputfilename > newfilename Is there a way to modify this command to specify the range of lines to be deleted, lets say from line 14 till line 5 ? I tried using the... (5 Replies)
Discussion started by: aoussenko
5 Replies

7. Shell Programming and Scripting

Grep a string from input file and delete next three lines including the line contains string in xml

Hi, 1_strings file contains $ cat 1_strings /home/$USER/Src /home/Valid /home/Review$ cat myxml <projected value="some string" path="/home/$USER/Src"> <input 1/> <estimate value/> <somestring/> </projected> <few more lines > <projected value="some string" path="/home/$USER/check">... (4 Replies)
Discussion started by: greet_sed
4 Replies

8. UNIX for Dummies Questions & Answers

How to delete specific lines (2n+3 line, n=0,1,2...296) in a file?

Dear everyone, I have a file with 900 lines (there is only numbers in one line, no string), I only need the lines 2+3n (n=0,1...296), i.e line 2, 5, 8, 11...888. I tried google but only the results such as how to delete all the odd lines or all the even lines with 'awk' command. Thanks in... (4 Replies)
Discussion started by: phamnu
4 Replies

9. UNIX for Advanced & Expert Users

How to find a string in a line in UNIX file and delete that line and previous 3 lines ?

Hi , i have a file with data as below.This is same file. But actual file contains to many rows. i want to search for a string "Field 039 00" and delete that line and previous 3 lines in that file.. Can some body suggested me how can i do using either sed or awk command ? Field 004... (7 Replies)
Discussion started by: vadlamudy
7 Replies

10. UNIX for Dummies Questions & Answers

Log file - Delete duplicate line & keep last date

Hello All ! I need your help on this case, I have a csv file with this: ITEM105;ARI FSR;2016-02-01 08:02;243 ITEM101;ARI FSR;2016-02-01 06:02;240 ITEM032;RNO TLE;2016-02-01 11:03;320 ITEM032;RNO TLE;2016-02-02 05:43;320 ITEM032;RNO TLE;2016-02-01 02:03;320 ITEM032;RNO... (2 Replies)
Discussion started by: vadim-bzh
2 Replies
hpisettime(1)							      OpenHPI							     hpisettime(1)

NAME
hpisettime - This sample openhpi application excercises Event Log clock APIs. SYNOPSIS
hpisettime [-D nn] [-N host[:port]] [-C <cfgfile>] -d mm/dd/yyyy -t HH:MM:SS [-X] [-h] hpisettime [--domain=nn] [--host=host[:port]] [--cfgfile=file] --date=mm/dd/yyyy --time=HH:MM:SS [--debug] [--help] DESCRIPTION
hpisettime sets new date and time for the Event Log clock. If no domain is selected, hpisettime uses a session with the default domain. The selected domain id must be configured via the openhpidclient.conf file specified in the environment. OPTIONS
Help Options: -h, --help Show help options Application Options: -d mm/dd/yyyy, --date=mm/dd/yyyy New date -t 24:12:60, --time=24:12:60 New time of day in 24-hr format -D nn, --domain=nn Select domain id nn -X, --debug Display debug messages -N "host[:port]", --host="host[:port]" Open session to the domain served by the daemon at the specified URL (host:port). This option overrides the OPENHPI_DAEMON_HOST and OPENHPI_DAEMON_PORT environment variables. If host contains ':' (for example IPv6 address) then enclose it in square brackets. For example: "[::1]" or "[::1]:4743". -C "file", --cfgfile="file" Use passed file as client configuration file. This option overrides the OPENHPICLIENT_CONf environment variable. SEE ALSO
hpi_shell hpialarms hpifan hpipower hpitop hpidomain hpigensimdata hpireset hpitree hpiel hpiiinv hpisensor hpiwdt hpievents hpionIBMblade hpithres hpixml ohdomainlist ohhandler ohparam AUTHORS
Authors of this man page: Peter D Phan (pdphan@users.sourceforge.net) Ulrich Kleber (ulikleber@users.sourceforge.net) Anton Pak (avpak@users.sourceforge.net) 3.2.1 2011-09-20 hpisettime(1)
All times are GMT -4. The time now is 10:09 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy