如何grep“U + 2028”?

时间:2016-10-20 23:27:40

标签: git unicode diff

git diff 告诉我,我的代码中有一些:

                     <div style={styles.loadingContainer}><U+2028>
                         <CircularProgress />
-                    </div><U+2028>
+                    </div>

我想grep所有文件来查找和删除这些文件。到目前为止,他们搞砸了设计并花了我3个小时的费用: - (

3 个答案:

答案 0 :(得分:1)

假设你正在使用bash,你可以使用它的字符串替换

grep $'\u2028' /path/to/file

其他炮弹可能具有相似的功能。

答案 1 :(得分:0)

  • 使用终端转到您的项目目录。
  • grep -nr U+2028

为了您的目标搜索&amp;在IDE中替换路径选项会有所帮助。对于intelliJ,您可以使用 Ctrl + Shift + R

答案 2 :(得分:0)

git diff 将 unicode 字符 2028(即 LINE SEPARATOR,参见例如 https://www.fileformat.info/info/unicode/char/2028/index.htm)显示为 <U+2028>

要查找使用此 unicode 字符的所有位置,请运行:

git grep "$(printf '\u2028')"

这使用命令 printf 生成请求的 unicode 字符,然后将其作为参数传递给 git grep