shell parsing a line to look for a certain tag

前端 未结 3 436
执念已碎
执念已碎 2021-01-26 02:15

I am planning to create a simple script to edit a file based on values stored within a properties file. So essentially I am planning to loop through each line in the original fi

3条回答
  •  说谎
    说谎 (楼主)
    2021-01-26 02:28

    For instance you can search for strings and manipulate them in one step using sed the stream editor.

    echo $line | sed -rn 's:^.*/#(certs.+):\1:p'
    

    This will print only the relevant parts after the /# of the relevant lines.

提交回复
热议问题