-1

My input looks like:

22/05/2016TAKEMEAWAY    nsorte dat TAKEMEAWAYd0 "https://bears.com"
22/05/2016TAKEMEAWAY nsorte dat TAKEMEAWAYd241  "https://bears.com"
22/05/2017TAKEMEAWAY nsorte her the TAKEMEAWAYd447020 "https://bears.com"
22/05/2017TAKEMEAWAY   nsorte TAKEMEAWAYd115155 "https://bears.com"
22/05/2017TAKEMEAWAY nsorte TAKEMEAWAYd6792 "https://bears.com"
22/05/2017TAKEMEAWAY   nsorte TAKEMEAWAYd625385 "https://bears.com"
22/05/201TAKEMEAWAYTAKEMEAWAY 20 vBul Dogs (  Cinema TAKEMEAWAY)4154850 "https://bulldogs.com/ my cats"
22/05/2017TAKEMEAWAYTAKEMEAWAY 20 vBul Dogs    (Cinema TAKEMEAWAY)4154880 "https://cats.com/my dogs"
22/05/2017TAKEMEAWAYTAKEMEAWAY   20 vBul Dogs (Cinema TAKEMEAWAY)4154830 "https://bears.com"
22/05/2017TAKEMEAWAYTAKEMEAWAY 20 vBul    Dogs (Cinema TAKEMEAWAY)4154820 "https://flowers.com"
22/05/2018TAKEMEAWAYTAKEMEAWAY 20 vBul Dogs (Cinema TAKEMEAWAY)4154810 "https://bulldogs.com"

I want the output with one space separating date on the left and number of bytes in the middle:

22/05/2016 0 "https://bears.com"
22/05/2016 241 "https://bears.com"
22/05/2017 447020 "https://bears.com"
22/05/2017 115155 "https://bears.com"
22/05/2017 6792 "https://bears.com"
22/05/2017 625385 "https://bears.com"
22/05/2017 4154850 "https://bulldogs.com/ my cats"
22/05/2017 4154880 "https://cats.com/my dogs"
22/05/2017 4154830 "https://bears.com"
22/05/2017 4154820 "https://flowers.com"
22/05/2018 4154810 "https://bulldogs.com"

Does anyone know how to do it in sed?

creed
  • 162
  • 1
  • 12
  • try to select answers as correct answer as well as try to up-vote people whoever trying to help you. – RavinderSingh13 Jun 22 '18 at 15:47
  • Stack Overflow is not a code writing service. We really need a *"Givez mez the codez"* Stack Exchange for folks who want to dump requirements without making an effort. – jww Jun 23 '18 at 05:30
  • The line ending with my dogs" there is a 7 missing is that correct? – Claes Wikner Jun 25 '18 at 10:39

1 Answers1

-1

One way to do it is to substitute a pattern that starts with TAKEMEAWAY and ends with TAKEMEAWAY followed by anything that's not a digit and replace the entire match with a space:

sed 's/TAKEMEAWAY.*TAKEMEAWAY[^[:digit:]]*/ /g' your_file
Eric Renouf
  • 12,640
  • 3
  • 34
  • 56