sed -n '/^00[012]0[ ]*/p' unknown_broadcast.txt | sed -n 's/^.*\(.\{17\}$\)/\1/p'| sed 's/^\(\.*!\.*\)*\([^.]*\)\(\.*\)*/\2/'| sed ':a;N;s/\r\n//;t a'
(ps:sed的正则怎么用不了非贪婪)
(ps:sed的正则怎么匹配不了行尾$)
1
In the gap a new tooth grew,And now it makes me wonder,If people are like teeth tooThe day I lost my very first tooth,Was halfway through grade four,I'd run my tongue along the gap,Where my tooth had been before,I remember I went home crying,And showed it to my mum,She told me that a brand new tooth,Would grow up in my gum,In a while the gap would stop feeling I wouldn't notice the tooth was gone,The only reason I missed it now,Was because it was there for so long,Then slowly but surely over the weeks,In the gap a new tooth grew,And now it makes me wonder,If people are like teeth tooThe day I lost my very first tooth,Was halfway through grade four,I'd run my tongue along the gap,Where my tooth had been before,I remember I went home crying,And showed it to my mum,She told me that a brand new tooth,Would grow up in my gum,In a while the gap would stop feeling I wouldn't notice the tooth was gone,The only reason I missed it now,Was because it was there for so long,Then slowly but surely over the weeks,In the gap a new tooth grew,And now it makes me wonder,If people are like teeth tooThe day I lost my very first tooth,Was halfway through grade four,I'd run my tongue along the gap,Where my tooth had been before,I remember I went home crying,And showed it to my mum,She told me that a brand new tooth,Would grow up in my gum,In a while the gap would stop feeling I wouldn't notice the tooth was gone,The only reason I missed it now,Was because it was there for so long,Then slowly but surely over the weeks,In the gap a new tooth grew,And now it makes me wonder,If people are like teeth tooThe day I lost my very first tooth,Was halfway through grade four,I'd run my tongue along the gap,Where my tooth had been before,I remember I went home crying,And showed it to my mum,She told me that a brand new tooth,Would grow up in my gum,In a while the gap would stop feeling I wouldn't notice the tooth was gone,The only reason I missed it now,Was because it was there for so long,Then slowly but surely over the weeks,In the gap a new tooth grew,And now it makes me wonder,If people are like teeth tooThe day I lost my very first tooth,Was halfway through grade four,I'd run my tongue along the gap,Where my tooth had been before,I remember I went home crying,And showed it to my mum,She told me that a brand new tooth,Would grow up in my gum,In a while the gap would stop feeling I wouldn't notice the tooth was gone,The only reason I missed it now,Was because it was there for so long,Then slowly but surely over the weeks,In the gap a new tooth grew,And now it makes me wonder,If people are like teeth tooThe day I lost my very first tooth,Was halfway through grade four,I'd run my tongue along the gap,Where my tooth had been before,I remember I went home crying,And showed it to my mum,She told me that a brand new tooth,Would grow up in my gum,In a while the gap would stop feeling I wouldn't notice the tooth was gone,The only reason I missed it now,Was because it was there for so long,Then slowly but surely over the weeks,In the gap a new tooth grew,And now it makes me wonder,If people are like teeth tooThe day I lost my very first tooth,
手动去掉重复片段整理:
1
The day I lost my very first tooth,Was halfway through grade four,I'd run my tongue along the gap,Where my tooth had been before,I remember I went home crying,And showed it to my mum,She told me that a brand new tooth,Would grow up in my gum,In a while the gap would stop feeling I wouldn't notice the tooth was gone,The only reason I missed it now,Was because it was there for so long,Then slowly but surely over the weeks,In the gap a new tooth grew,And now it makes me wonder,If people are like teeth too.
拿上面这小作文一搜,发现是首诗。。。。。换下行:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
The day I lost my very first tooth, Was halfway through grade four, I'd run my tongue along the gap, Where my tooth had been before, I remember I went home crying, And showed it to my mum, She told me that a brand new tooth, Would grow up in my gum, In a while the gap would stop feeling I wouldn't notice the tooth was gone, The only reason I missed it now, Was because it was there for so long, Then slowly but surely over the weeks, In the gap a new tooth grew, And now it makes me wonder, If people are like teeth too
怎么我抓出来的跟搜出来的差一个词,In a while the gap would stop feeling strange这句,我的怎么没有strange,手动去翻了一下unknown_broadcast.txt,发现是有strange的,检查发现是sed写错了,改为:
1
sed -n 's/^00[0123]0[ ]\{2,\}.*[ ]\{2,\}\([\.]*\)/\1/p' unknown_broadcast.txt | sed 's/^\(\.*!\.*\)*\([^.]*\)\(\.*\)*/\2/' | sed '/^[ ]\{3,\}/d' | sed ':a;N;s/\r\n//;t a'