unterminated address regex while using sed

前端 未结 3 1417
无人及你
无人及你 2021-01-12 01:59

I am using the below command but while running the command in linux, getting the below error.

sed -n \'/^[2015/01/01 03:46/,/^[2015/01/01 03:47/p\' < Inpu         


        
3条回答
  •  温柔的废话
    2021-01-12 02:15

    You need to escape the [, or else it thinks its start of a group, and escape to / in your data.

    sed -n '/^\[2015\/01\/01 03:46/,/^\[2015\/01\/01 03:47/p' Input.txt
    

    or (thanks to nu11p01n73R)

    sed -n '\|^\[2015/01/01 03:46|,\|^\[2015/01/01 03:47|p' Input.txt
    

提交回复
热议问题