简体   繁体   English

Sed正则表达式不起作用

[英]Sed regex does not work

The following command does not return anything and i think my regex is good ? 以下命令不返回任何内容,我认为我的正则表达式是好的?

echo 'The.Big.Bang.Theory.S07E01.VOSTFR.720p.WEB-DL.DD5.1.H.264-GKS.mkv' |\
sed -n '/The.Big.Bang.Theory*VOSTFR*720p*WEB-DL*.mkv/p'

Thanks! 谢谢!

  • \\. matches the . 匹配. char 烧焦
  • .* matches any char zero or more times: .*匹配任何 char零次或多次:

    sed -n '/The\\.Big\\.Bang\\.Theory.*VOSTFR.*720p.*WEB-DL.*\\.mkv/p'

y* means zero or more y s. y*表示零或更多y s。 R* means zero or more R s. R*表示零个或多个R s。 etc. 等等

You probably want 你可能想要

/The\.Big\.Bang\.Theory.*VOSTFR*720p.*WEB-DL.*\.mkv/

Works like this : 像这样工作:

echo 'The.Big.Bang.Theory.S07E01.VOSTFR.720p.WEB-DL.DD5.1.H.264-GKS.mkv' |\
sed -n '/The.Big.Bang.Theory.*VOSTFR.*720p.*WEB-DL.*.mkv/p'

I forgot the dots :/ 我忘了点:/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM