• <legend id='MCxBn'><style id='MCxBn'><dir id='MCxBn'><q id='MCxBn'></q></dir></style></legend>
    • <bdo id='MCxBn'></bdo><ul id='MCxBn'></ul>

      <tfoot id='MCxBn'></tfoot>

      <i id='MCxBn'><tr id='MCxBn'><dt id='MCxBn'><q id='MCxBn'><span id='MCxBn'><b id='MCxBn'><form id='MCxBn'><ins id='MCxBn'></ins><ul id='MCxBn'></ul><sub id='MCxBn'></sub></form><legend id='MCxBn'></legend><bdo id='MCxBn'><pre id='MCxBn'><center id='MCxBn'></center></pre></bdo></b><th id='MCxBn'></th></span></q></dt></tr></i><div id='MCxBn'><tfoot id='MCxBn'></tfoot><dl id='MCxBn'><fieldset id='MCxBn'></fieldset></dl></div>

        <small id='MCxBn'></small><noframes id='MCxBn'>

      1. 在 BOF 或 EOF 中查找所有带有空白或 WS 的文件

        时间:2023-05-21

          1. <legend id='tXFZ2'><style id='tXFZ2'><dir id='tXFZ2'><q id='tXFZ2'></q></dir></style></legend>

            <small id='tXFZ2'></small><noframes id='tXFZ2'>

              <tbody id='tXFZ2'></tbody>
              <bdo id='tXFZ2'></bdo><ul id='tXFZ2'></ul>

            • <i id='tXFZ2'><tr id='tXFZ2'><dt id='tXFZ2'><q id='tXFZ2'><span id='tXFZ2'><b id='tXFZ2'><form id='tXFZ2'><ins id='tXFZ2'></ins><ul id='tXFZ2'></ul><sub id='tXFZ2'></sub></form><legend id='tXFZ2'></legend><bdo id='tXFZ2'><pre id='tXFZ2'><center id='tXFZ2'></center></pre></bdo></b><th id='tXFZ2'></th></span></q></dt></tr></i><div id='tXFZ2'><tfoot id='tXFZ2'></tfoot><dl id='tXFZ2'><fieldset id='tXFZ2'></fieldset></dl></div>
                <tfoot id='tXFZ2'></tfoot>
                • 本文介绍了在 BOF 或 EOF 中查找所有带有空白或 WS 的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  限时送ChatGPT账号..

                  每个人都知道 PHP 讨厌在文件的开头或结尾(在 PHP 标签之前或之后)出现空行.

                  Everyone knows PHP hates blank lines at the beginning or end of a file (before or after the PHP tags).

                  我有一个 awk 脚本可以修改文件.我通过它传递了我的所有文件,一切都很好,没有更多的前导或尾随空行.

                  I've got an awk script that will modify the files. I pass all my files through it and things are peachy, no more leading or trailing blank lines.

                  我想先查找文件,以构建快速异常报告.

                  I'd like to FIND the files first, to build a quick exception report.

                  我尝试过这样的事情:

                  grep -r -e :a -e '/^
                  *$/{$d;N;};/
                  $/ba'
                  

                  但那是错误的.

                  推荐答案

                  此 shell 脚本将遍历您的所有文件,并在每个文件的开头或结尾找到空行时进行打印:

                  This shell script will go through all your files and print if it found a blank line at the beginning or end of each file:

                  for f in `find . -type f`; do 
                    for t in head tail; do 
                      $t -1 $f  |egrep '^[  ]*$' >/dev/null && echo "blank line at the $t of $f"; 
                    done; 
                  done
                  

                  为了可读性我打破了线条,但你也可以将它作为单行运行.

                  I broke the lines for readability, but you can run it as a one liner too.

                  示例输出:

                  blank line at the head of ./b
                  blank line at the tail of ./c
                  blank line at the head of ./d
                  blank line at the tail of ./d
                  

                  这篇关于在 BOF 或 EOF 中查找所有带有空白或 WS 的文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:用 &lt;?php 替换 PHP 短打开标签的批处理脚本 下一篇:使用正则表达式删除注入

                  相关文章

                  最新文章

                  1. <tfoot id='sG3XZ'></tfoot>
                    <i id='sG3XZ'><tr id='sG3XZ'><dt id='sG3XZ'><q id='sG3XZ'><span id='sG3XZ'><b id='sG3XZ'><form id='sG3XZ'><ins id='sG3XZ'></ins><ul id='sG3XZ'></ul><sub id='sG3XZ'></sub></form><legend id='sG3XZ'></legend><bdo id='sG3XZ'><pre id='sG3XZ'><center id='sG3XZ'></center></pre></bdo></b><th id='sG3XZ'></th></span></q></dt></tr></i><div id='sG3XZ'><tfoot id='sG3XZ'></tfoot><dl id='sG3XZ'><fieldset id='sG3XZ'></fieldset></dl></div>

                      <small id='sG3XZ'></small><noframes id='sG3XZ'>

                        <bdo id='sG3XZ'></bdo><ul id='sG3XZ'></ul>
                      <legend id='sG3XZ'><style id='sG3XZ'><dir id='sG3XZ'><q id='sG3XZ'></q></dir></style></legend>