Update README.md

This commit is contained in:
skyper
2023-12-14 17:58:18 +00:00
committed by GitHub
parent 4df57a6a48
commit 4bdeb20a38
+6 -5
View File
@@ -1634,11 +1634,12 @@ This will reset the logfile to 0 without having to restart syslogd etc:
This will remove any line containing the IP `1.2.3.4` from the log file:
```sh
#DEL=thc.org
#DEL=${SSH_CLIENT%% *}
DEL=1.2.3.4
LOG=/var/log/auth.log
IFS="" a=$(sed "/${DEL}/d" <"${LOG}") && echo "$a">"${LOG}"
xlog() {
local a=$(sed "/${1:?}/d" <"${2:?}") && echo "$a" >"${2:?}"
}
xlog "1\.2\.3\.4" /var/log/auth.log
# xlog "${SSH_CLIENT%% *}" /var/log/auth.log
# xlog "^2023.* thc\.org" foo.log
```
<a id="shell-hide-files"></a>