1. 首先常见一个txt格式的文件,里面有一下内容
CLANG_CONFIG_x86_LINUX_HOST_EXTRA_ASFLAGS := \
	--gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
	--sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
	-no-integrated-as
  1. 使用shell的sed命令,增加内容
    格式: sed -i /old/&new/ 文件

  2. 增加内容如下:

-B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin
  1. 执行命令如下:
sed -i 's/-no-integrated-as/&\ \\\n\t-B$\($\(clang_2nd_arch_prefix\)HOST_TOOLCHAIN_FOR_CLANG\)\/x86_64-linux\/bin/' 1.txt
  1. 结果如下
CLANG_CONFIG_x86_LINUX_HOST_EXTRA_ASFLAGS := \
	--gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \
	--sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \
	-no-integrated-as \
	-B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin
Logo

更多推荐