sed를 이용하면 된다.
http://www.gnu.org/software/sed/manual/html_node/Regular-Expressions.html
예제 1)
코드
$ echo '<google/>' | sed 's|<\([^/]*\)/>|<\1></\1>|'
결과
$ <google></google>
예제 2)
코드
echo "<path>aaaaaaaa/bbbb/ccc</path>" | sed 's|<\path>\(.*\)<\/path>|<\path>'"$TESTBOX_DIR/logs"'</\path>|'
결과
<path>ABC/logs</path>
'c or linux' 카테고리의 다른 글
| clang: error: unknown argument: '-mno-fused-madd' (0) | 2014.05.19 |
|---|---|
| 인증서(certificate) curl을 이용해서 다운받기 (0) | 2014.03.11 |
| [bashscript] Regex 적용하기 (regular expression) (0) | 2014.02.14 |
| [bash] variables in sed (sed 안에서 변수 사용하기) (0) | 2014.02.14 |
| [리눅스] 네트워크 ACL 체크 (0) | 2013.04.03 |
| nginx nexus 연동 (reverse proxy이용) (0) | 2013.04.02 |



댓글을 달아 주세요