红联Linux门户
Linux帮助

新手求问行尾定位符的问题

发布时间:2011-05-06 01:24:19来源:红联作者:变换之风1986
写了grep '0$' datafile(datafile为含有数据的文件)发现却毫无反应,明明数据文件中有以0结尾的行 请问这是怎么回事呢??
文章评论

共有 2 条评论

  1. 相思爱文 于 2011-05-06 18:09:26发表:

    windows下编辑的,$前还有一个^M字符。用cat -A查看,和linux下不一样。

  2. deepwhite 于 2011-05-06 08:56:18发表:

    it works on my machine.[code]yyc@localhost ~ $ echo abc >> a.txt
    yyc@localhost ~ $ echo 430 >> a.txt
    yyc@localhost ~ $ echo abc >> a.txt
    yyc@localhost ~ $ cat a.txt
    abc
    430
    abc
    yyc@localhost ~ $ grep '0$' a.txt
    430
    [/code]