文件中包含以下内容。如何删除从find: Filesystem loop detected;
开始的所有行?
find: Filesystem loop detected; `/nfs/.snapshot/nightly.4' has the same device number and inode as a directory which is 2 levels higher in the filesystem hierarchy.
find: Filesystem loop detected; `/nfs/.snapshot/nightly.5' has the same device number and inode as a directory which is 2 levels higher in the filesystem hierarchy.
find: Filesystem loop detected; `/nfs/.snapshot/nightly.6' has the same device number and inode as a directory which is 2 levels higher in the filesystem hierarchy.
Owner RepoName CreatedDate
asasasa s sasasas
答案 0 :(得分:2)
为什么不grep
?
grep -v '^find: Filesystem loop detected;' myFile
答案 1 :(得分:1)
sed的:
sed '/^find: Filesystem loop detected/d' file
AWK:
awk '!/^find: Filesystem loop detected/' file
正如mouviciel指出的那样,grep也是一个不错的选择。
答案 2 :(得分:0)
有多种方式。
使用sed,最简单的方法可能是:
sed -n '1,/find: Filesystem loop detected/p' /path/to/logfile
将outpout重定向到临时文件,移动该文件代替日志文件,然后重新启动syslogd。
关于命令如何工作: