列出/usr/bin中的所有文件,其文件名只包含小写英文字母,还包含单词文件作为(连续的)子字符串。
例如,git-ls-files文件和profiles就是这样的文件。
这正是我的问题所在,我只能使用grep、ls、cat和wc。
ls /usr/bin/ | grep '[^-]*file'
这是我到目前为止得到的,输出在下面。例如,我不知道如何显示file,因为* is zero or more occurences。也不知道怎么把小写的东西放进regex里。
check-binary-files
clean-binary-files
desktop-file-insta
我有两个文件,old.txt
Line 1
Line 2
Line 3
Line4
Line5
Line 7
Line 7
Line 8
和new.txt
Line 1
Line 2
Line 3
Line 4
Line 5
Line 6
Line 7
Line 8
如果我运行git diff --no-index --word-diff-regex=. old.txt new.txt,那么它将显示唯一的更改是在第4和第5行上修复空格,并在第6行上修复错误的数字:
diff --git a/old.txt b/new.txt
index be8495f..a982fdc 100644
---
我想比较两个文件中的行,但是为了尽量减少输出中的噪声,我只想要打印行中的实际差异。
例如,考虑到以下两个文件:
.
a b c d e f g h i j k l m n o p q r s t u v w x y z
<>b.txt
a B c d e f g h i j k l m n o p q r s t u v w x y z
(它们之间的区别是字母b__的情况)
我希望输出的内容如下:
[-b-]{+B+}
目前,我发现最好的方法是使用git diff --word-diff,但是它输出了整个行:
a [-b-]{+B+} c d e f g h i j k l m n
我想为git diff --name-status设置bash输出的样式,以便状态为D、M和A的文件具有不同的颜色。
要样式化一般的git bash,我使用.gitconfig中的color选项。
# .gitconfig
[color]
branch = auto
diff = auto
status = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
fr