cat myfile | sed -e 's/^/line_head:/' 이런식으로하면 매 라인마다 line_head: 가 붙어서 출력되기는 하는데요... "ine_head:" 대신 "a/b:" 이런걸 쓰고 싶은데 슬래쉬가 있어서 걸리네요.. 어떻게 하면 좋죠...
cat myfile | sed -e 's/^/line_head:/'
cat myfile | sed -e 's/^/\//'
<어떠한 역경에도 굴하지 않는 '하양 지훈'>
#include <com.h> <C2H5OH.h> <woman.h> do { if (com) hacking(); if (money) drinking(); if (women) loving(); } while (1);
분리자를 "/" 대신 "%"를 써보세요.
cat myfile | sed -e 's%^%a/b%'
--- 배려하는 마음을 갖자.
구분자 / 는 다른 것으로 바꿀 수있습니다.
cat myfile | sed -e 's!^!line_head:!'
세 개가 같으면 되죠
cat myfile | sed -e 'sX^Xline_head:X'
---http://coolengineer.com
단순히 행번호만 필요하다면
cat -n myfile
이런 방법도 있지요. )
세벌 https://sebuls.blogspot.kr/
텍스트 포맷에 대한 자세한 정보
<code>
<blockcode>
<apache>
<applescript>
<autoconf>
<awk>
<bash>
<c>
<cpp>
<css>
<diff>
<drupal5>
<drupal6>
<gdb>
<html>
<html5>
<java>
<javascript>
<ldif>
<lua>
<make>
<mysql>
<perl>
<perl6>
<php>
<pgsql>
<proftpd>
<python>
<reg>
<spec>
<ruby>
<foo>
[foo]
[code:1]cat myfile | sed -e 's/^/\//' [/
cat myfile | sed -e 's/^/\//'
<어떠한 역경에도 굴하지 않는 '하양 지훈'>
#include <com.h> <C2H5OH.h> <woman.h>
do { if (com) hacking(); if (money) drinking(); if (women) loving(); } while (1);
Re: sed 에서 문자열에 슬래쉬(/)가 있는경우..
분리자를 "/" 대신 "%"를 써보세요.
---
배려하는 마음을 갖자.
구분자 / 는 다른 것으로 바꿀 수있습니다. cat myfile
구분자 / 는 다른 것으로 바꿀 수있습니다.
cat myfile | sed -e 's!^!line_head:!'
세 개가 같으면 되죠
cat myfile | sed -e 'sX^Xline_head:X'
---
http://coolengineer.com
주제와 조금 벗어나지만...
단순히 행번호만 필요하다면
cat -n myfile
이런 방법도 있지요. )
세벌 https://sebuls.blogspot.kr/
댓글 달기