Write script that extracts DATES from log files between any 5 dates and count of those DATES in log files

I want to write script that extracts DATES from log files between any 5 dates and count of those DATES in log files (how many times dates present in that log file) ???

Welcome on board!

I want to write script that extracts DATES from log files between any 5 dates

Yes? what have you done so far?

That is easy once the first part is OK...

Do you mind giving us also your OS, version, and the current shell you are using?
Thanks

I'm using rhel 7 and bash scripting please help in this script

Try to code

That is what you should do @Linux1

Maybe have a think about the following:

  • What format are the dates in?
  • Are the logfiles sequential?
  • If so what command would you use to match a date larger than your start date?
  • How would you use that to trigger the start of saving out records?
  • How you match the end of you time period?
    Then come back with code (or even pseudo code) and people will help

Date is in normal format
Logs are sequential but dates are not in sequential

Im new to scripting i dont know from where to start
i extracted random dates from log file i stuck here the count of dates (in that log file) which i extracted from log file.

Because you are a student and this is homework, because your requirement is mostly academic:

I want to write script that extracts DATES from log files between any 5 dates and count of those DATES in log files (how many times dates present in that log file)...

This is an academic exercise; not something folks would generally do in "the real world".... as there generally is no real practical application to do this; but it is of academic value to students.

1 Like

This is obviously a homework problem and the poster broke at least two rules in posting this:

  1. Did not declare homework as homework.
  2. Did not use a descriptive subject text.
  3. Did not show any effort to do their own work.

It's simply another (lazy) student trying to get others do to their homework for them while hiding the fact they are a student asking others to do their homework for them.

Again, it's totally obvious this is undeclared homework (as confirmed by the student's subsequent reply).