我的输入如下:
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"
我希望输出的左边有一个空格,中间是字节数:
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"
有人知道如何在sed
中进行操作吗?
答案 0 :(得分:-1)
一种方法是替换以TAKEMEAWAY
开头并以TAKEMEAWAY
结尾的模式,后跟不是数字的任何内容,然后用空格替换整个匹配项:
sed 's/TAKEMEAWAY.*TAKEMEAWAY[^[:digit:]]*/ /g' your_file