1. regex 중 matching pattern reuse
1) %s/abcd\(.*\)z/aaaa\1a/g
--> "abcd"로 시작해서 "z"로 끝나는 문자열을 "aaaa"로 시작해서 "a"로 끝나는 문자열로 바꾼다.
--> 예) abcd1234z --> aaaa1234a, abcdefghi..z --> aaaaefghi..a
2) %s/abcd\(.*{1,10}\)123\(.*\)0/1234\1abc\2z/g
--> "abcd*123*0" 형태의 문자열을 "1234*abc*z"형태로 바꾼다.
--> 예) abcdefg1234560 --> 1234efgabc456z
2011년 7월 28일 목요일
2011년 7월 12일 화요일
bash : 특정 process status 표시하기
한줄 command로 특정 process status를 표시하는 방법.
$ ps -ef |grep [process_bin] |grep -v grep \
|cut -d ' ' -f 2 |xargs -i cat /proc/{}/status
|cut -d ' ' -f 2 |xargs -i cat /proc/{}/status
* cut 명령어 부분은 ps -ef의 표시 방법에 따라서 적절하게 변경해야 한다.
* grep명령어 부분은 grep [P]rocess_bin 과 같이 "[]"를 이용해서 하나로 쓸 수 있다.
ps | grep 사용하면서 grep process표시하지 않도록 하기
http://www.cyberciti.biz/tips/grepping-ps-output-without-getting-grep.html
example)
example)
$ ps -ef |grep [L]libraryLauncher
피드 구독하기:
글 (Atom)