0
   25422572,2018-04-01,00:00:27,e7961e25-5f46-4c81-b85d-36ce404bf72e,891672
   25422631,2018-04-01,00:01:21,41afad62-c037-4bed-9568-f76f3a86eb10,891672,

I have a data like shown above, up to 2018-04-30 .I want to split it down in 3 files for 10 days each. How can I do this through Linux commands ?

Pranav Totla
  • 2,182
  • 2
  • 20
  • 28
  • What have you tried so far? To prevent downvotes please see: https://meta.stackoverflow.com/questions/261592/how-much-research-effort-is-expected-of-stack-overflow-users and https://stackoverflow.com/help/how-to-ask and https://stackoverflow.com/help/on-topic - maybe ask a search engine first for "linux split text file pattern" to get a starting point. after that edit your answer where you got stuck – MacMartin May 23 '18 at 07:23
  • Possible duplicate of [How to split a large text file into smaller files with equal number of lines?](https://stackoverflow.com/questions/2016894/how-to-split-a-large-text-file-into-smaller-files-with-equal-number-of-lines) – Doktor OSwaldo May 23 '18 at 07:35

1 Answers1

0

You could use grep:

grep -E "2018-04-(0[1-9]|10)" input.txt > out1.txt                            
grep -E "2018-04-(1[1-9]|20)" input.txt > out2.txt                            
grep -E "2018-04-(2[1-9]|30)" input.txt > out3.txt                            
builder-7000
  • 7,131
  • 3
  • 19
  • 43