本文主要是介绍grep得到的内容用sed处理,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
grep得到的内容用sed处理
-E or Extended Regular Expressions
I mentioned extended regular expressions earlier. FreeBSD (and Mac OS X) uses “-E” to enable this. However, FreeBSD later added the -r command to be compatible with GNU sed.
-e <script>或--expression=<script> 以选项中指定的script来处理输入的文本文件。
Multiple commands with -e command
One method of combining multiple commands is to use a -e before each command:
sed -e ‘s/a/A/’ -e ‘s/b/B/’ new
A “-e” isn’t needed in the earlier examples because sed knows that there must always be one command. If you give sed one argument, it must be a command, and sed will edit the data read from standard input.
The long argument version is
sed --expression=‘s/a/A/’ --expression=‘s/b/B/’ new
# -E 可以省略
dir_name="log_data829"
mkdir $dir_namegrep -ri 'dut_rd_sqe.dut' vivado.log | sed -E -e 's/dut/haip/g' -e 's/a44/000/g'> $dir_name/dut_sqe.dat
grep -ri 'haip_rd_sqe.haip' vivado.log > $dir_name/haip_sqe.datgrep -ri 'dut_db_slv_agent' vivado.log | sed -E 's/dut/haip/g' > $dir_name/dut_db.dat
grep -ri 'haip_db_slv_agent' vivado.log > $dir_name/haip_db.datgrep -ri 'dut_cqe_axis_slave' vivado.log | sed -E 's/dut/haip/g'> $dir_name/dut_cqe.dat
grep -ri 'haip_cqe_axis_slave' vivado.log > $dir_name/haip_cqe.datdiff $dir_name/dut_sqe.dat $dir_name/haip_sqe.datdiff $dir_name/dut_db.dat $dir_name/haip_db.dat
diff $dir_name/dut_cqe.dat $dir_name/haip_cqe.dat
这篇关于grep得到的内容用sed处理的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!