删除\tcolor开头的行

  • user warning: Table './zgq_smzz/blog_comments' is marked as crashed and should be repaired query: SELECT COUNT(*) FROM blog_comments c WHERE c.nid = 12 AND c.status = 0 in /home/www/zhouguoqiang/zhoume.org/modules/comment/comment.module on line 992.
  • user warning: Table './zgq_smzz/blog_comments' is marked as crashed and should be repaired query: SELECT c.cid as cid, c.pid, c.nid, c.subject, c.comment, c.format, c.timestamp, c.name, c.mail, c.homepage, u.uid, u.name AS registered_name, u.signature, u.signature_format, u.picture, u.data, c.thread, c.status FROM blog_comments c INNER JOIN blog_users u ON c.uid = u.uid WHERE c.nid = 12 AND c.status = 0 ORDER BY c.thread DESC LIMIT 0, 50 in /home/www/zhouguoqiang/zhoume.org/modules/comment/comment.module on line 992.

color.css文件如下:
\tcolor: #ccc;
\tcolor: #ffffff;
\tcolor: red;
\tbackground-color: #000;
\tborder-color: #fff;
...
为了集中管理颜色,欲将所有color开头的行删除。这似乎不是awk/sed的特长,于是在vim里使用正则匹配替换:
%s/\scolor.*$//g

但是留下空白的行,很不是完美。

干脆使用grep:
grep -v '\tcolor:.*$' color_background.css > color.new.css
不知为何,没有任何匹配。

最后,还是输入tab的控制符解决的问题
grep -v ' color:.*$' color_background.css > color.new.css

注意:终端下按Ctrl V后,方可输入相应的控制符。

update:
vim中%g/\tcolor.*$/d也可以解决。

Comments

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options