PHP-FIG
PHP Framework Interop Group
PSR
PHP Standard Recommendation
DevOps
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
phpor@phpor-Latitude-E6440:~$ echo -e "a\nb\n"|sed -n '1p' # -n 默认不输出 a phpor@phpor-Latitude-E6440:~$ echo -e "a\nb\n"|sed '$d' a b phpor@phpor-Latitude-E6440:~$ echo -e "a\nb\n"|sed '1d' b phpor@phpor-Latitude-E6440:~$ echo -e "a\nb\n"|sed '2,$d' a phpor@phpor-Latitude-E6440:~$ echo -e "a\nb\n"|sed '/a/d' b phpor@phpor-Latitude-E6440:~$ echo -e "a\nb\n"|sed '/^$/d' a b phpor@phpor-Latitude-E6440:~$ echo -e "a\nb\n"|sed '2,$d' a phpor@phpor-Latitude-E6440:~$ echo -e "a\nb\n"|sed '/a/d' b phpor@phpor-Latitude-E6440:~$ echo -e "a\nb\n"|sed '/^$/d' a b phpor@phpor-Latitude-E6440:~$ echo -e "a\nb\n"|sed 's/ //' a b phpor@phpor-Latitude-E6440:~$ echo -e "a b\nb\n"|sed 's/ //' ab b phpor@phpor-Latitude-E6440:~$ echo -e "a b c\nb\n"|sed 's/ //' ab c b phpor@phpor-Latitude-E6440:~$ echo -e "a b c\nb\n"|sed 's/ //g' abc b phpor@phpor-Latitude-E6440:~$ echo -e "a b c\nb\n"|sed 's/^a/&mm/' amm b c b phpor@phpor-Latitude-E6440:~$ echo -e "a b c a c\nb\n"|sed 's/^a/&mm/' amm b c a c b phpor@phpor-Latitude-E6440:~$ echo -e "a b c a c\nb\n"|sed 's/a/&mm/g' amm b c amm c b phpor@phpor-Latitude-E6440:~$ echo -e "a\nb\n"|sed '/a/a\ >m' a m b phpor@phpor-Latitude-E6440:~$ echo -e "a\nb\n"|sed '/a/a\ #在匹配到的行后插入新行,添加多行时,每行(除最后一行)后面都要用 \ 续行 > m\ > n\ > p' a m n p b phpor@phpor-Latitude-E6440:~$ echo -e "a\nb\n"|sed '/a/i\ #在匹配到的行前插入新行 >m\ >n\ >p' m n p a b phpor@phpor-Latitude-E6440:~$ echo -e "a\nb\n"|sed '/a/c\ #用新行替换掉匹配到的行 >m\ >n\ >p' m n p b phpor@phpor-Latitude-E6440:~$ echo -e "a1b2c3\n" |sed -e 's/a//' -e 's/b//' -e's/c//' #使用 -e 选项对统一行进行多次处理 123 phpor@phpor-Latitude-E6440:~$ echo -e "123\n456\n789\nabc" | sed -n '/456/{n;p}' #打印匹配到的那行的下一行 789 phpor@phpor-Latitude-E6440:~$ echo -e "123\n456\n789\nabc" | sed -n '/456/{n;n;p}' #打印匹配到的那行的下一行的下一行 abc phpor@phpor-Latitude-E6440:~$ echo -e "badc\n"|sed 'y/abcd/ABCD/' #该命令与UNIX/Linux中的tr命令类似,字符按照一对一的方式从左到右进行转换 BADC sed -i '/sudo route add/r /tmp/updatephplib.txt' /tmp/Vagrantfile #匹配到某一行后,把制定文件的内容append进去;注意: 1. r命令不能用在花括号中 2. 文件名后面不能有空格 |
在匹配到的行尾添加:
删除匹配后的N行(delete n lines following a pattern)or (delete n lines after match/matches)
1 2 |
echo -e "1\n2\n3\n3\n4\n"|sed '/2/,+2d' 1 |
如果匹配到的行不需要删除
正则替换:
将 “craete time: 1988-02-02 11:22:12″ 替换为”craete time: 1988-02-02T11:22:12”
1 |
sed -r 's/(-[0-9]{2})\ ([0-9]{2})/\1T\2/' |
参考资料: http://blog.csdn.net/holandstone/article/details/8488434
http://stackoverflow.com/questions/4396974/sed-or-awk-delete-n-lines-following-a-pattern
http://stackoverflow.com/questions/8323287/how-can-i-use-sed-to-delete-2-lines-after-match-matches
svn cp $from $to
其中: $from $to 都可以是url或本地路径, 如果 $to 是本地路径,则还需一次 commit, 如果 $to 是url 则是直接提交
http://svnbook.red-bean.com/en/1.7/
Your Subversion repository is like a time machine. It keeps a record of every change ever committed and allows you to explore this history by examining previous versions of files and directories as well as the metadata that accompanies them. With a single Subversion command, you can check out the repository (or restore an existing working copy) exactly as it was at any date or revision number in the past. However, sometimes you just want to peer into the past instead of going into it.
Several commands can provide you with historical data from the repository:
SVN是以版本号(revision number)来记录版本库的每一次改变,一般的SVN操作不需要用到版本号,但是有些SVN操作需要指定版本号。我们可以指定一个明确的整数版本号,但是也可以使用SVN关键字来指代某个特殊的版本号,SVN会真正计算出它所指代的实际整数版本号:
HEAD:版本库中最新的版本;
BASE:某个工作副本项的版本,注意这个是你上次update该项时的版本号,可能晚于当前最新的版本号;
COMMITTED:某个工作副本项最近修改的版本,与BASE相同或更早;
PREV:COMMITTED – 1。
HEAD针对于版本库,另外3个针对于某个工作副本目录或文件。
示例:
$ svn diff -r PREV:COMMITTED foo.c
# shows the last change committed to foo.c
$ svn log -r HEAD
# shows log message for the latest repository commit
$ svn diff -r HEAD
# compares your working copy (with all of its local changes) to the latest version of that tree in the repository
$ svn diff -r BASE:HEAD foo.c
# compares the unmodified version of foo.c with the latest version of foo.c in the repository
$ svn log -r BASE:HEAD
# shows all commit logs for the current versioned directory since you last updated
$ svn update -r PREV foo.c
# rewinds the last change on foo.c, decreasing foo.c’s working revision
$ svn diff -r BASE:14 foo.c
# compares the unmodified version of foo.c with the way foo.c looked in revision 14
原文链接: http://www.cnblogs.com/frydsh/archive/2012/08/25/2655569.html
1 2 |
cd /path/to/trunk svn merge --reintegrate ^/branch_xxx |
1 2 |
cd /path/to/branch svn merge ^/trunk |