Compare two text two files whilst one contains column with date [closed]

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











up vote
-3
down vote

favorite












I have two text files, one of them contains:



...
2018-09-22 FFF1B976-9DDE-11E7-9C3D-6241D7D553BE
2018-09-27 682D9DB6-C0A2-11E8-B7A8-3ECB9C0CC049
2018-09-27 682D9DB6-C0A2-11E8-B7A8-3ECB9C0CC049.bai
2018-09-27 6846DFEC-C0A2-11E8-B7A8-3ECB9C0CC049
2018-09-27 6846DFEC-C0A2-11E8-B7A8-3ECB9C0CC049.bai
...


Whilst the other one contains:



...
CA9442F2-8C8C-11E7-8637-ABE8E6BF8454
ED3B2906-0117-11E8-BA0B-30D761F1560A
E9A927E4-8B9B-11E7-9435-18B114A47675
373667F0-8B93-11E7-B918-13B114A47675
15D861C4-BB82-11E8-A989-7D57C505C2C3
...


What I'd like to achieve is to compare one to another and display only lines older than 30 days.










share|improve this question















closed as unclear what you're asking by RalfFriedl, Thomas, G-Man, Goro, Jeff Schaller Sep 28 at 2:20


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • Hello @Kamil. Visually, I can tell there is no difference. Kindly would you please add more context to the question and make it clear? Please include int he question the expected output
    – Goro
    Sep 27 at 15:32







  • 2




    "compare one to another" -- with what comparison rules?
    – glenn jackman
    Sep 27 at 15:41










  • @Goro Above there are only fragment of files. The one with dates has 38289 lines, while the other one has 28. I need to find out if there are lines in the smaller file occurring in the bigger list but with date older than 30 days. I hope that helped.
    – Syn Romana
    Sep 27 at 15:45






  • 1




    Please add that information into the body of your question.
    – glenn jackman
    Sep 27 at 15:47






  • 2




    Not a single match between the samples - that doesn't really help to infer what you need, as your description is quite vague.
    – RudiC
    Sep 27 at 16:16














up vote
-3
down vote

favorite












I have two text files, one of them contains:



...
2018-09-22 FFF1B976-9DDE-11E7-9C3D-6241D7D553BE
2018-09-27 682D9DB6-C0A2-11E8-B7A8-3ECB9C0CC049
2018-09-27 682D9DB6-C0A2-11E8-B7A8-3ECB9C0CC049.bai
2018-09-27 6846DFEC-C0A2-11E8-B7A8-3ECB9C0CC049
2018-09-27 6846DFEC-C0A2-11E8-B7A8-3ECB9C0CC049.bai
...


Whilst the other one contains:



...
CA9442F2-8C8C-11E7-8637-ABE8E6BF8454
ED3B2906-0117-11E8-BA0B-30D761F1560A
E9A927E4-8B9B-11E7-9435-18B114A47675
373667F0-8B93-11E7-B918-13B114A47675
15D861C4-BB82-11E8-A989-7D57C505C2C3
...


What I'd like to achieve is to compare one to another and display only lines older than 30 days.










share|improve this question















closed as unclear what you're asking by RalfFriedl, Thomas, G-Man, Goro, Jeff Schaller Sep 28 at 2:20


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.














  • Hello @Kamil. Visually, I can tell there is no difference. Kindly would you please add more context to the question and make it clear? Please include int he question the expected output
    – Goro
    Sep 27 at 15:32







  • 2




    "compare one to another" -- with what comparison rules?
    – glenn jackman
    Sep 27 at 15:41










  • @Goro Above there are only fragment of files. The one with dates has 38289 lines, while the other one has 28. I need to find out if there are lines in the smaller file occurring in the bigger list but with date older than 30 days. I hope that helped.
    – Syn Romana
    Sep 27 at 15:45






  • 1




    Please add that information into the body of your question.
    – glenn jackman
    Sep 27 at 15:47






  • 2




    Not a single match between the samples - that doesn't really help to infer what you need, as your description is quite vague.
    – RudiC
    Sep 27 at 16:16












up vote
-3
down vote

favorite









up vote
-3
down vote

favorite











I have two text files, one of them contains:



...
2018-09-22 FFF1B976-9DDE-11E7-9C3D-6241D7D553BE
2018-09-27 682D9DB6-C0A2-11E8-B7A8-3ECB9C0CC049
2018-09-27 682D9DB6-C0A2-11E8-B7A8-3ECB9C0CC049.bai
2018-09-27 6846DFEC-C0A2-11E8-B7A8-3ECB9C0CC049
2018-09-27 6846DFEC-C0A2-11E8-B7A8-3ECB9C0CC049.bai
...


Whilst the other one contains:



...
CA9442F2-8C8C-11E7-8637-ABE8E6BF8454
ED3B2906-0117-11E8-BA0B-30D761F1560A
E9A927E4-8B9B-11E7-9435-18B114A47675
373667F0-8B93-11E7-B918-13B114A47675
15D861C4-BB82-11E8-A989-7D57C505C2C3
...


What I'd like to achieve is to compare one to another and display only lines older than 30 days.










share|improve this question















I have two text files, one of them contains:



...
2018-09-22 FFF1B976-9DDE-11E7-9C3D-6241D7D553BE
2018-09-27 682D9DB6-C0A2-11E8-B7A8-3ECB9C0CC049
2018-09-27 682D9DB6-C0A2-11E8-B7A8-3ECB9C0CC049.bai
2018-09-27 6846DFEC-C0A2-11E8-B7A8-3ECB9C0CC049
2018-09-27 6846DFEC-C0A2-11E8-B7A8-3ECB9C0CC049.bai
...


Whilst the other one contains:



...
CA9442F2-8C8C-11E7-8637-ABE8E6BF8454
ED3B2906-0117-11E8-BA0B-30D761F1560A
E9A927E4-8B9B-11E7-9435-18B114A47675
373667F0-8B93-11E7-B918-13B114A47675
15D861C4-BB82-11E8-A989-7D57C505C2C3
...


What I'd like to achieve is to compare one to another and display only lines older than 30 days.







linux awk sed files






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Sep 27 at 16:04









Goro

6,67752865




6,67752865










asked Sep 27 at 15:23









Syn Romana

123




123




closed as unclear what you're asking by RalfFriedl, Thomas, G-Man, Goro, Jeff Schaller Sep 28 at 2:20


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.






closed as unclear what you're asking by RalfFriedl, Thomas, G-Man, Goro, Jeff Schaller Sep 28 at 2:20


Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.













  • Hello @Kamil. Visually, I can tell there is no difference. Kindly would you please add more context to the question and make it clear? Please include int he question the expected output
    – Goro
    Sep 27 at 15:32







  • 2




    "compare one to another" -- with what comparison rules?
    – glenn jackman
    Sep 27 at 15:41










  • @Goro Above there are only fragment of files. The one with dates has 38289 lines, while the other one has 28. I need to find out if there are lines in the smaller file occurring in the bigger list but with date older than 30 days. I hope that helped.
    – Syn Romana
    Sep 27 at 15:45






  • 1




    Please add that information into the body of your question.
    – glenn jackman
    Sep 27 at 15:47






  • 2




    Not a single match between the samples - that doesn't really help to infer what you need, as your description is quite vague.
    – RudiC
    Sep 27 at 16:16
















  • Hello @Kamil. Visually, I can tell there is no difference. Kindly would you please add more context to the question and make it clear? Please include int he question the expected output
    – Goro
    Sep 27 at 15:32







  • 2




    "compare one to another" -- with what comparison rules?
    – glenn jackman
    Sep 27 at 15:41










  • @Goro Above there are only fragment of files. The one with dates has 38289 lines, while the other one has 28. I need to find out if there are lines in the smaller file occurring in the bigger list but with date older than 30 days. I hope that helped.
    – Syn Romana
    Sep 27 at 15:45






  • 1




    Please add that information into the body of your question.
    – glenn jackman
    Sep 27 at 15:47






  • 2




    Not a single match between the samples - that doesn't really help to infer what you need, as your description is quite vague.
    – RudiC
    Sep 27 at 16:16















Hello @Kamil. Visually, I can tell there is no difference. Kindly would you please add more context to the question and make it clear? Please include int he question the expected output
– Goro
Sep 27 at 15:32





Hello @Kamil. Visually, I can tell there is no difference. Kindly would you please add more context to the question and make it clear? Please include int he question the expected output
– Goro
Sep 27 at 15:32





2




2




"compare one to another" -- with what comparison rules?
– glenn jackman
Sep 27 at 15:41




"compare one to another" -- with what comparison rules?
– glenn jackman
Sep 27 at 15:41












@Goro Above there are only fragment of files. The one with dates has 38289 lines, while the other one has 28. I need to find out if there are lines in the smaller file occurring in the bigger list but with date older than 30 days. I hope that helped.
– Syn Romana
Sep 27 at 15:45




@Goro Above there are only fragment of files. The one with dates has 38289 lines, while the other one has 28. I need to find out if there are lines in the smaller file occurring in the bigger list but with date older than 30 days. I hope that helped.
– Syn Romana
Sep 27 at 15:45




1




1




Please add that information into the body of your question.
– glenn jackman
Sep 27 at 15:47




Please add that information into the body of your question.
– glenn jackman
Sep 27 at 15:47




2




2




Not a single match between the samples - that doesn't really help to infer what you need, as your description is quite vague.
– RudiC
Sep 27 at 16:16




Not a single match between the samples - that doesn't really help to infer what you need, as your description is quite vague.
– RudiC
Sep 27 at 16:16










1 Answer
1






active

oldest

votes

















up vote
0
down vote



accepted










You can find lines older than 30 days with GNU tools:



awk -v month_ago="$(date -d '30 days ago' '+%F')" '
NR == FNR ids[$1]; next
$1 < month_ago && $2 in ids
' small_file big_file


This reads the small file first (when NR == FNR), storing the values in an array.

Then for lines in the big file, where the date is older than 30 days and the 2nd field has appeared in the smaller file, print that line.






share|improve this answer






















  • I want to check each line from the second file against the first one, but display only lines which are 30 days old.
    – Syn Romana
    Sep 27 at 15:48










  • That worked! Thank you.
    – Syn Romana
    Sep 27 at 15:52

















1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes








up vote
0
down vote



accepted










You can find lines older than 30 days with GNU tools:



awk -v month_ago="$(date -d '30 days ago' '+%F')" '
NR == FNR ids[$1]; next
$1 < month_ago && $2 in ids
' small_file big_file


This reads the small file first (when NR == FNR), storing the values in an array.

Then for lines in the big file, where the date is older than 30 days and the 2nd field has appeared in the smaller file, print that line.






share|improve this answer






















  • I want to check each line from the second file against the first one, but display only lines which are 30 days old.
    – Syn Romana
    Sep 27 at 15:48










  • That worked! Thank you.
    – Syn Romana
    Sep 27 at 15:52














up vote
0
down vote



accepted










You can find lines older than 30 days with GNU tools:



awk -v month_ago="$(date -d '30 days ago' '+%F')" '
NR == FNR ids[$1]; next
$1 < month_ago && $2 in ids
' small_file big_file


This reads the small file first (when NR == FNR), storing the values in an array.

Then for lines in the big file, where the date is older than 30 days and the 2nd field has appeared in the smaller file, print that line.






share|improve this answer






















  • I want to check each line from the second file against the first one, but display only lines which are 30 days old.
    – Syn Romana
    Sep 27 at 15:48










  • That worked! Thank you.
    – Syn Romana
    Sep 27 at 15:52












up vote
0
down vote



accepted







up vote
0
down vote



accepted






You can find lines older than 30 days with GNU tools:



awk -v month_ago="$(date -d '30 days ago' '+%F')" '
NR == FNR ids[$1]; next
$1 < month_ago && $2 in ids
' small_file big_file


This reads the small file first (when NR == FNR), storing the values in an array.

Then for lines in the big file, where the date is older than 30 days and the 2nd field has appeared in the smaller file, print that line.






share|improve this answer














You can find lines older than 30 days with GNU tools:



awk -v month_ago="$(date -d '30 days ago' '+%F')" '
NR == FNR ids[$1]; next
$1 < month_ago && $2 in ids
' small_file big_file


This reads the small file first (when NR == FNR), storing the values in an array.

Then for lines in the big file, where the date is older than 30 days and the 2nd field has appeared in the smaller file, print that line.







share|improve this answer














share|improve this answer



share|improve this answer








edited Sep 27 at 15:50

























answered Sep 27 at 15:46









glenn jackman

48.3k365105




48.3k365105











  • I want to check each line from the second file against the first one, but display only lines which are 30 days old.
    – Syn Romana
    Sep 27 at 15:48










  • That worked! Thank you.
    – Syn Romana
    Sep 27 at 15:52
















  • I want to check each line from the second file against the first one, but display only lines which are 30 days old.
    – Syn Romana
    Sep 27 at 15:48










  • That worked! Thank you.
    – Syn Romana
    Sep 27 at 15:52















I want to check each line from the second file against the first one, but display only lines which are 30 days old.
– Syn Romana
Sep 27 at 15:48




I want to check each line from the second file against the first one, but display only lines which are 30 days old.
– Syn Romana
Sep 27 at 15:48












That worked! Thank you.
– Syn Romana
Sep 27 at 15:52




That worked! Thank you.
– Syn Romana
Sep 27 at 15:52


Popular posts from this blog

Peggy Mitchell

Palaiologos

The Forum (Inglewood, California)