grep dates in a text file to less than 30 days old and move to a new file [duplicate]

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP












-2















This question already has an answer here:



  • How to grep a date lesser than a particular date in a file [closed]

    2 answers



A script that should look out for texts with a date inside the file thats 30 days older than the current date then move to another file like the
$ awk '$NF <= "2018-05-01"' ip.txt
but need a command to get text with dates 30 days older than the system current date automatically without having to manually change the script everyday










share|improve this question















marked as duplicate by G-Man, Ipor Sircer, muru, Rui F Ribeiro, Jeff Schaller Dec 18 at 10:12


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • A script that should look out for texts with a date inside the file thats 30 days older than the current date then move to another file like the $ awk '$NF <= "2018-05-01"' ip.txt but need a command to get text with dates 30 days older than the system current date automatically without having to manually change the script everyday
    – Kasiiku Mark
    Dec 19 at 6:10















-2















This question already has an answer here:



  • How to grep a date lesser than a particular date in a file [closed]

    2 answers



A script that should look out for texts with a date inside the file thats 30 days older than the current date then move to another file like the
$ awk '$NF <= "2018-05-01"' ip.txt
but need a command to get text with dates 30 days older than the system current date automatically without having to manually change the script everyday










share|improve this question















marked as duplicate by G-Man, Ipor Sircer, muru, Rui F Ribeiro, Jeff Schaller Dec 18 at 10:12


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.














  • A script that should look out for texts with a date inside the file thats 30 days older than the current date then move to another file like the $ awk '$NF <= "2018-05-01"' ip.txt but need a command to get text with dates 30 days older than the system current date automatically without having to manually change the script everyday
    – Kasiiku Mark
    Dec 19 at 6:10













-2












-2








-2








This question already has an answer here:



  • How to grep a date lesser than a particular date in a file [closed]

    2 answers



A script that should look out for texts with a date inside the file thats 30 days older than the current date then move to another file like the
$ awk '$NF <= "2018-05-01"' ip.txt
but need a command to get text with dates 30 days older than the system current date automatically without having to manually change the script everyday










share|improve this question
















This question already has an answer here:



  • How to grep a date lesser than a particular date in a file [closed]

    2 answers



A script that should look out for texts with a date inside the file thats 30 days older than the current date then move to another file like the
$ awk '$NF <= "2018-05-01"' ip.txt
but need a command to get text with dates 30 days older than the system current date automatically without having to manually change the script everyday





This question already has an answer here:



  • How to grep a date lesser than a particular date in a file [closed]

    2 answers







grep date






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 19 at 5:58

























asked Dec 18 at 6:53









Kasiiku Mark

61




61




marked as duplicate by G-Man, Ipor Sircer, muru, Rui F Ribeiro, Jeff Schaller Dec 18 at 10:12


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by G-Man, Ipor Sircer, muru, Rui F Ribeiro, Jeff Schaller Dec 18 at 10:12


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.













  • A script that should look out for texts with a date inside the file thats 30 days older than the current date then move to another file like the $ awk '$NF <= "2018-05-01"' ip.txt but need a command to get text with dates 30 days older than the system current date automatically without having to manually change the script everyday
    – Kasiiku Mark
    Dec 19 at 6:10
















  • A script that should look out for texts with a date inside the file thats 30 days older than the current date then move to another file like the $ awk '$NF <= "2018-05-01"' ip.txt but need a command to get text with dates 30 days older than the system current date automatically without having to manually change the script everyday
    – Kasiiku Mark
    Dec 19 at 6:10















A script that should look out for texts with a date inside the file thats 30 days older than the current date then move to another file like the $ awk '$NF <= "2018-05-01"' ip.txt but need a command to get text with dates 30 days older than the system current date automatically without having to manually change the script everyday
– Kasiiku Mark
Dec 19 at 6:10




A script that should look out for texts with a date inside the file thats 30 days older than the current date then move to another file like the $ awk '$NF <= "2018-05-01"' ip.txt but need a command to get text with dates 30 days older than the system current date automatically without having to manually change the script everyday
– Kasiiku Mark
Dec 19 at 6:10










1 Answer
1






active

oldest

votes


















0














cmd:



for i in 1..30; do date +%Y-%m-%d -d "$i day ago"; done >outputfile


output:



 cat outputfile
2018-12-17
2018-12-16
2018-12-15
2018-12-14
2018-12-13
2018-12-12
2018-12-11
2018-12-10
2018-12-09
2018-12-08
2018-12-07
2018-12-06
2018-12-05
2018-12-04
2018-12-03
2018-12-02
2018-12-01
2018-11-30
2018-11-29
2018-11-28
2018-11-27
2018-11-26
2018-11-25
2018-11-24
2018-11-23
2018-11-22
2018-11-21
2018-11-20
2018-11-19
2018-11-18





share|improve this answer




















  • $ cat ip.txt Blah blah blah 2018-12-13 Blah blah blah 2018-02-13 Blah blah blah 2018-05-01 $ awk '$NF < "2018-05-01"' ip.txt Blah blah blah 2018-02-13 if possible similar to that without having to manually input the current date as shown in the 2018-05-01 but automatically system date
    – Kasiiku Mark
    Dec 19 at 6:43

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














cmd:



for i in 1..30; do date +%Y-%m-%d -d "$i day ago"; done >outputfile


output:



 cat outputfile
2018-12-17
2018-12-16
2018-12-15
2018-12-14
2018-12-13
2018-12-12
2018-12-11
2018-12-10
2018-12-09
2018-12-08
2018-12-07
2018-12-06
2018-12-05
2018-12-04
2018-12-03
2018-12-02
2018-12-01
2018-11-30
2018-11-29
2018-11-28
2018-11-27
2018-11-26
2018-11-25
2018-11-24
2018-11-23
2018-11-22
2018-11-21
2018-11-20
2018-11-19
2018-11-18





share|improve this answer




















  • $ cat ip.txt Blah blah blah 2018-12-13 Blah blah blah 2018-02-13 Blah blah blah 2018-05-01 $ awk '$NF < "2018-05-01"' ip.txt Blah blah blah 2018-02-13 if possible similar to that without having to manually input the current date as shown in the 2018-05-01 but automatically system date
    – Kasiiku Mark
    Dec 19 at 6:43















0














cmd:



for i in 1..30; do date +%Y-%m-%d -d "$i day ago"; done >outputfile


output:



 cat outputfile
2018-12-17
2018-12-16
2018-12-15
2018-12-14
2018-12-13
2018-12-12
2018-12-11
2018-12-10
2018-12-09
2018-12-08
2018-12-07
2018-12-06
2018-12-05
2018-12-04
2018-12-03
2018-12-02
2018-12-01
2018-11-30
2018-11-29
2018-11-28
2018-11-27
2018-11-26
2018-11-25
2018-11-24
2018-11-23
2018-11-22
2018-11-21
2018-11-20
2018-11-19
2018-11-18





share|improve this answer




















  • $ cat ip.txt Blah blah blah 2018-12-13 Blah blah blah 2018-02-13 Blah blah blah 2018-05-01 $ awk '$NF < "2018-05-01"' ip.txt Blah blah blah 2018-02-13 if possible similar to that without having to manually input the current date as shown in the 2018-05-01 but automatically system date
    – Kasiiku Mark
    Dec 19 at 6:43













0












0








0






cmd:



for i in 1..30; do date +%Y-%m-%d -d "$i day ago"; done >outputfile


output:



 cat outputfile
2018-12-17
2018-12-16
2018-12-15
2018-12-14
2018-12-13
2018-12-12
2018-12-11
2018-12-10
2018-12-09
2018-12-08
2018-12-07
2018-12-06
2018-12-05
2018-12-04
2018-12-03
2018-12-02
2018-12-01
2018-11-30
2018-11-29
2018-11-28
2018-11-27
2018-11-26
2018-11-25
2018-11-24
2018-11-23
2018-11-22
2018-11-21
2018-11-20
2018-11-19
2018-11-18





share|improve this answer












cmd:



for i in 1..30; do date +%Y-%m-%d -d "$i day ago"; done >outputfile


output:



 cat outputfile
2018-12-17
2018-12-16
2018-12-15
2018-12-14
2018-12-13
2018-12-12
2018-12-11
2018-12-10
2018-12-09
2018-12-08
2018-12-07
2018-12-06
2018-12-05
2018-12-04
2018-12-03
2018-12-02
2018-12-01
2018-11-30
2018-11-29
2018-11-28
2018-11-27
2018-11-26
2018-11-25
2018-11-24
2018-11-23
2018-11-22
2018-11-21
2018-11-20
2018-11-19
2018-11-18






share|improve this answer












share|improve this answer



share|improve this answer










answered Dec 18 at 8:53









Praveen Kumar BS

1,206138




1,206138











  • $ cat ip.txt Blah blah blah 2018-12-13 Blah blah blah 2018-02-13 Blah blah blah 2018-05-01 $ awk '$NF < "2018-05-01"' ip.txt Blah blah blah 2018-02-13 if possible similar to that without having to manually input the current date as shown in the 2018-05-01 but automatically system date
    – Kasiiku Mark
    Dec 19 at 6:43
















  • $ cat ip.txt Blah blah blah 2018-12-13 Blah blah blah 2018-02-13 Blah blah blah 2018-05-01 $ awk '$NF < "2018-05-01"' ip.txt Blah blah blah 2018-02-13 if possible similar to that without having to manually input the current date as shown in the 2018-05-01 but automatically system date
    – Kasiiku Mark
    Dec 19 at 6:43















$ cat ip.txt Blah blah blah 2018-12-13 Blah blah blah 2018-02-13 Blah blah blah 2018-05-01 $ awk '$NF < "2018-05-01"' ip.txt Blah blah blah 2018-02-13 if possible similar to that without having to manually input the current date as shown in the 2018-05-01 but automatically system date
– Kasiiku Mark
Dec 19 at 6:43




$ cat ip.txt Blah blah blah 2018-12-13 Blah blah blah 2018-02-13 Blah blah blah 2018-05-01 $ awk '$NF < "2018-05-01"' ip.txt Blah blah blah 2018-02-13 if possible similar to that without having to manually input the current date as shown in the 2018-05-01 but automatically system date
– Kasiiku Mark
Dec 19 at 6:43


Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay