Linux命令之sed
1、替换某字符后的所有字符为特定字符,可以使用保留字符替换法,如下内容,文件为/etc/default/grub
GRUB_TIMEOUT=1 GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)" GRUB_DEFAULT=saved GRUB_DISABLE_SUBMENU=true GRUB_TERMINAL_OUTPUT="console" GRUB_CMDLINE_LINUX="biosdevname=0 net.ifnames=0 console=tty0 console=ttyS0,115200 noibrs crashkernel=auto rhgb quiet" GRUB_DISABLE_RECOVERY="true"
将GRUB_TIMEOUT后面的任意数字替换成"=5",命令如下
sed -i "s/\(GRUB_TIMEOUT\).*/\1=5/g" /etc/default/grub
”
每天更新一点点,温习一点点点,进步一点点