How to match content between HTML specific tags with attribute using grep?

前端 未结 3 1044
时光说笑
时光说笑 2020-12-31 07:43

Which regular expression should I use with the command grep if I wanted to match the text contained within the tag

and it
3条回答
  •  清酒与你
    2020-12-31 07:54

    You can do that by specifying a regex:

    grep -E "^
    .*
    $" input_files

    Not that this will only print the enclosures found on the same line. If your tag spans multiple lines, you can try:

    tr '\n' ' ' < input_file | grep -E "^
    .*
    $"

提交回复
热议问题