F***Q 发帖数: 6599 | 1 要查找文件中的特定的行末标志比如
0<回车>
40<回车>
能否用regular expression来查找,就向word中的^p一样
thx! |
m*****e 发帖数: 4193 | 2 know C? '\n'
【在 F***Q 的大作中提到】 : 要查找文件中的特定的行末标志比如 : 0<回车> : 40<回车> : 能否用regular expression来查找,就向word中的^p一样 : thx!
|
F***Q 发帖数: 6599 | 3 但是我用
grep '0\n40\n' myfile
却找不到:(
【在 m*****e 的大作中提到】 : know C? '\n'
|
m*****e 发帖数: 4193 | 4 1. which grep are you using? You should use GNU grep or egrep.
2. make sure your lines do not end with '\r\n' like most files
edited under DOS
【在 F***Q 的大作中提到】 : 但是我用 : grep '0\n40\n' myfile : 却找不到:(
|
c*****t 发帖数: 1879 | 5 hmm, I don't think that egrep can do that either. It buffers
only a line.
【在 m*****e 的大作中提到】 : 1. which grep are you using? You should use GNU grep or egrep. : 2. make sure your lines do not end with '\r\n' like most files : edited under DOS
|
F***Q 发帖数: 6599 | 6 I use AIX 4.3
both grep and egrep give me the first line of the file when
i use
?grep '\n' myfile
but can't find all of the lines,also,the specified line I
am searching
sed even dosen't accept '\n':(
【在 c*****t 的大作中提到】 : hmm, I don't think that egrep can do that either. It buffers : only a line.
|
m*****e 发帖数: 4193 | 7 No idea. GNU grep works for me on both Linux and Solaris.
【在 F***Q 的大作中提到】 : I use AIX 4.3 : both grep and egrep give me the first line of the file when : i use : ?grep '\n' myfile : but can't find all of the lines,also,the specified line I : am searching : sed even dosen't accept '\n':(
|
t*********l 发帖数: 30 | 8 sed -n '/0$/{N;/04$/p}' yourfil
【在 F***Q 的大作中提到】 : 但是我用 : grep '0\n40\n' myfile : 却找不到:(
|