0

I am having a log file which contains many months and I want to extract all the logs from one month.

The log file line starts like this

2018-05-31 12:30:00 INFO:
2018-06-18 12:31:00 INFO:
2018-07-32 12:36:00 INFO:
.....

So I tried

grep -i "^2018\-06" input.csv >output.csv

But this only generates an empty file. Any help is appreciated.

  • 1
    the given command works for me for the given sample.. you could also use grep '^2018-06' .. – Sundeep Jun 25 '18 at 9:58
  • You sure, you tried same exact command? It should have worked, I ran and it giving output – mkmayank Jun 25 '18 at 9:58
  • 2
    try to debug further.. for example, does grep '2018' input.csv work? try other variations on this until you spot the issue.. probably some typo on your end? also, what is the output of type grep? – Sundeep Jun 25 '18 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.