Why doesn't grep give the matching line? -
i've noticed that
grep -rni 'a2}' *
does not give all documents have string matching line. why case?a2}
i've tried create minimal example, when create new file , paste content, fails. i've uploaded file git repository. perhaps it's encoding problem.
the content of file is:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \chapter{kv-diagramme} \label{chap:a2} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \pstexabbildungohnecaption{figures/a2-1} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% local variables: %%% mode: latex %%% tex-master: "skript" %%% end:
the result of grep -rni 'a2}' *
is
moose@pc08 ~/downloads/algorithms/grep $ grep -rni "a2}" * %%% end:master: "skript"%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
but expected
moose@pc08 ~/downloads/algorithms/grep $ grep -rni "a2}" * \label{chap:a2}
why result?
the file has cr line terminators looks a single-line file:
#> file anhang-2.tex anhang-2.tex: latex document, ascii text, cr line terminators
convert linux format:
#> mac2unix anhang-2.tex mac2unix: converting file anhang-2.tex unix format ... #> grep -rni 'a2}' anhang-2.tex 3:\label{chap:a2}
Comments
Post a Comment