Chinaunix

标题: sed替换求助,正则表达式 [打印本页]

作者: doking2008    时间: 2010-08-30 18:03
标题: sed替换求助,正则表达式
求助:替换MSWinEventLog        2        Application        3162        Fri Aug 27 17:42:13 2010
替换以MS开头,2010结尾的字符串,为@。

Aug 27 17:42:17 1.1.1.1 adb.host.com MSWinEventLog        2        Application        3162        Fri Aug 27 17:42:13 2010        2284        W3SVC-WP        Unknown User        N/A        Warning        adb.host.com         0000: 50 00 07 80 00 00 00 00   .......          FailedRequestTracing module failed to write buffered events to log file for the request that matched failure definition. No logs will be generated until this condition is corrected. The problem happened at least 49 times in the last 5 minutes. The data is the error.          3114
作者: jiwang1980    时间: 2010-08-30 18:25
sed 's/MS.*2010/@/' file

最长匹配,不知道你的数据会不会出事
作者: rdcwayx    时间: 2010-08-30 18:26
  1. sed 's/MSWinEventLog .* 2010/@/' infile
复制代码

作者: bbgg1983    时间: 2010-08-30 19:25
你们都很犀利,那么我学习了




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2