#!/bin/bash
#指定要修改的文件和行号
file_path="top.v"
line_number=76
#读取文件内容并修改指定行
old_line=$(sed -n "${line_number}p" "$file_path")
new_line=".cfg3 (32'h00000000), "
set -i "${line_number}s/.*/${new_line}/" "file_path"
echo "已经修改第${line_number}行,从${old_line}改为${new_line}"
source run.tcl
matlab -nodisplay -nosplash -nodesktop -r "script;exit;"
通过bash来实现对指定文件某行的修改,并运行脚本
最新推荐文章于 2025-04-22 19:37:58 发布