As I have to deal with the plain text file in Windows and I want to solve this issue with elegant behavior, I know I need to choose the tool Vim or Emacs. This time, the Windows platform has helped me make my decision, the Emacs. Comparing with Vim, I think there’s much less deployment part to start my work.
I won’t finish this post at once. In fact, I prepare to add contents in this post as I learned new skills of Emacs.
Here I need to replace the newline with space, and replace
M-x replace-string C-q C-j RET [Space] RET
C-q Cjrepresents newline.
RETrepresents keyboard Enter
[Space]just as keyboard Space
FF, page break:
Search Text in Multiple Files
Use one complicated command as example. Search text line with <xsl:output but exclude UTF-8 in all *.xsl or *.XSL files. In fact, here we just use the Unix command to finish our task in Emacs. You need to use
M-! to enter the shell mode.
find . -type f -iname "*.xsl" -print0 | xargs -0 -e grep -nH -e "<xsl:output" | grep -v "UTF-8"
This complicated command contains 4 parts:
findpart: search file type under
.folder, with case insensitive name *.xsl. Output with
-print0option, which will be used in
xargspart: construct parameter for the following
-0option to deal with file name containing space or other special characters.
greppart: search text <xsl:output.
greppart: ignoring text UTF-8.
Also, if you only want to search *.xsl file containing <xsl:output text, you can just use Emacs command
rgrep directly. You need to press
M-x and then type