I have to look through jsp file and look for for string loginpage.jsp and replace with ../loginPage.jsp. I have tried following: 1st try:
sed -i -e 's/<a id="logo" href="loginPage.jsp"><span class="alt">abc</span> </a>/<a id="logo" href="../loginPage.jsp"><span class="alt">abc</span></a>/g'
2nd try:
SRC="'loginPage.jsp'"
DEST="'sub2/loginPage.jsp'"
sed -i "s/$SRC/$DEST/g" <file path>/test1.jsp
3rd try using line number is file
var="response.sendRedirect("sub2/loginPage.jsp");"
sed "19 s/.*/$var/" <file path>/test1.jsp
Could you please guide me how to achieve this? Thanks,
since your input text has slash too, you should either escape all slashes in your input or use another separator, for example, try these:
sed 's#<....>#replacement#g' file
or
sed -i "s#$SRC#$DEST#g" <file path>/test1.jsp
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다