bash - Adding at the end of single line by matching using shell scripts -
i have shell script test.sh , content whithin shell script i'm using exec command run java command
export t1= exec java -xx:+useconcmarksweepgc -xx:+printclasshistogram .. dosomething
now have modify argument dymanically add " -dfile.encoding=utf-8" in solaris, , i'm using sed command to
export t1 exec java -xx:+useconcmarksweepgc -xx:+printclasshistogram -dfile.encoding=utf-8 ... dosomething
i;m new sed commad , it's not working can have other alternatives
sed -e "s/^\(exec \java.*\)$/\1 -dfile.encoding=utf-8/" test.sh > $test.sh.tmp
you can use sed:
sed -i.bak '/exec java/s/$/-dfile.encoding=utf-8/' test.sh cat test.sh export t1= exec java -xx:+useconcmarksweepgc -xx:+printclasshistogram -dfile.encoding=utf-8 .. dosomething
Comments
Post a Comment