lmgsanm

每天学习一点,每天进步一点点…… Tomorrow is another beatifull day

导航

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

 

 

 

posted on 2022-04-29 00:08  lmgsanm  阅读(65)  评论(0编辑  收藏  举报