github地址
shell 中grep 和 awk的使用,与svn结合(后续进行整理和添加)
为了提高在命令行下工作效率
eg:
svn add svn st | grep ^? | awk '{print $2}'
;
svn delete svn st | grep ^! | awk '{print $2}'
;
### grep 历史
grep这个应用程序最早由肯·汤普逊写成。grep原先是ed下的一个应用程序,名称来自于g/re/p(globally search a regular expression and print,以正规表示法进行全域查找以及打印)。在ed下,输入g/re/p这个命令后,会将所有匹配先定义样式的字符串,以行为单位打印出来。
在1973年,Unix第四版中,grep首次出现在man页面中。
man 手册中对于grep命令的介绍
NAME
grep, egrep, fgrep, zgrep, zegrep, zfgrep – file pattern searcher
SYNOPSIS
grep [-abcdDEFGHhIiJLlmnOopqRSsUVvwxZ] [-A num] [-B num] [-C[num]]
[-e pattern] [-f file] [–binary-files=value] [–color[=when]]
[–colour[=when]] [–context[=num]] [–label] [–line-buffered]
[–null] [pattern] [file …]
DESCRIPTION
The grep utility searches any given input files, selecting lines that
match one or more patterns. By default, a pattern matches an input line
if the regular expression (RE) in the pattern matches the input line
without its trailing newline. An empty expression matches every line.
Each input line that matches at least one of the patterns is written to
the standard output.
grep is used for simple patterns and basic regular expressions (BREs);
egrep can handle extended regular expressions (EREs). See re_format(7)
for more information on regular expressions. fgrep is quicker than both
grep and egrep, but can only handle fixed patterns (i.e. it does not
interpret regular expressions). Patterns may consist of one or more
lines, allowing any of the pattern lines to match a portion of the input.
zgrep, zegrep, and zfgrep act like grep, egrep, and fgrep, respectively,
but accept input files compressed with the compress(1) or gzip(1) com-
pression utilities.
The following options are available:
-A num, --after-context=num
Print num lines of trailing context after each match. See also
the -B and -C options.
-a, --text
Treat all files as ASCII text. Normally grep will simply print
``Binary file ... matches'' if files contain binary characters.
Use of this option forces grep to output lines matching the spec-
ified pattern.
-B num, --before-context=num