5

git diff is showing me there have been a few of these in my code:

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

I would like to grep all files to find and remove these. They were screwing up the design and costing me like 3 hours so far :-(

kev
  • 8,928
  • 14
  • 61
  • 103

3 Answers3

2

Assuming you're using bash you can use its string substitution

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

Other shells may have similar features.

the8472
  • 40,999
  • 5
  • 70
  • 122
  • That doesn't work for me. `git diff`shows: but grep doesn't produce any output. Vim shows me there is a character before the line break. If I delete that character, git diff doesn't show anymore. – kev Oct 21 '16 at 00:38
0

git diff is showing the unicode character 2028 (i.e. LINE SEPARATOR, see eg. https://www.fileformat.info/info/unicode/char/2028/index.htm) as <U+2028>.

To find all places where this unicode character is used, run:

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

This uses the command printf to produce the requested unicode char, which is then passed to git grep as an argument.

tbleher
  • 1,077
  • 1
  • 9
  • 17
-1
  • Go to your project directory with terminal.
  • grep -nr U+2028

For your objective Search & Replace path option in your IDE would help. For intelliJ you can use Ctrl + Shift + R.

Supun Wijerathne
  • 11,964
  • 10
  • 61
  • 87