I’m using Git Bash while writing this post. I’ve never tested the commands on *nix.
Background
Some of the tags and titles were written as “LateX”/“latex” in the source files. I batch corrected them with Git Grep and GNU Sed.
git grep --name-only -IiE ^-\ latex$'\r'? content/{post,page} | \
xargs -n1 sed -i "s/^- latex/- LaTeX/I"
I tried to match
- a leading
-
using^-
- a whitespace
\
escaped by a backslash to avoid wrapping the special character below with double quotes - the string “latex” (case-insensitive)
- the carriage return
\r
, which is represented by$'\r'
in bash, for at most once (?
)
I observed that wrapping $'\r'
with ""
would lead to no match.