当 grep 某个字符串时,我想删除文件中的第一个字符。但是需要在编辑之前更改的行位于同一位置。
示例文件:
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
#auth sufficient pam_wheel.so trust use_uid
auth include system-auth
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
编辑后的预期视图:
#%PAM-1.0
auth sufficient pam_rootok.so
# Uncomment the following line to implicitly trust users in the "wheel" group.
auth sufficient pam_wheel.so trust use_uid
auth include system-auth
account sufficient pam_succeed_if.so uid = 0 use_uid quiet
在这种情况下,第 4 行只需要删除“#”,但我想在搜索字符串“sufficient pam_wheel.so trust use_uid”时这样做,而不是在指向我要编辑的确切行时。