i have a txt file contenting the following information -Xmx4096m -Xms4096m -verbose:gc -XX:+UseParNewGC -XX:+CMSParallelRemarkEnabled -XX:+ScavengeBeforeFullGC -Dsun.net.inetaddr.ttl=3600 -XX:NewSize=1024m -XX:MaxNewSize=1024m -XX:CMSInitiatingOccupancyFraction=70 -XX:+UseCMSInitiatingOccupancyOnly -XX:+PrintTenuringDistribution -XX:SurvivorRatio=6 -XX:+UseConcMarkSweepGC -XX:+PrintGCDetails -XX:+PrintGCDateStamps -XX:+PrintHeapAtGC -XX:PermSize=256m -XX:MaxPermSize=256m -Xloggc:/www/logs/jboss/macys-navapp_master_mcomnavapp_m01/gc-log.txt -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/www/logs/heapdump/macys-navapp_master_mcomnavapp_m01/macys-navapp_master_mcomnavapp_m01.hprof -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=true -Djboss.modules.system.pkgs=org.jboss.byteman -Djava.awt.headless=true -XX:+UseCompressedOops -Dclient.encoding.override=ISO-8859-1 -XX:+DisableExplicitGC -Dfile.encoding=ISO-8859-1 -Dorg.apache.jasper.Constants.USE_INSTANCE_MANAGER_FOR_TAGS=false -Dorg.apache.jasper.Constants.USE_INSTANCE_MANAGER -Dorg.apache.jasper.runtime.JspFactoryImpl.USE_POOL=false -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Dsdp.configuration.home=/www/apps/properties -Dzookeeper.sasl.client=false -agentpath:/www/apps/dynatrace/dynatrace_apm/agent/lib64/libdtagent.so=name=agent_name,collector=dtcoldev_new:9998 XX:MaxPermSize=256m -Xloggc:/www/logs/jboss/macys-navapp_master_mcomnavapp_m01/gc-log.txt -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/www/logs/heapdump/macys-navapp_master_mcomnavapp_m01/macys-navapp_master_mcomnavapp_m01.hprof -Djava.net.preferIPv4Stack=true -Dorg.jboss.resolver.warning=trueI only want to remove the string content -agentpath:/www/apps/dynatrace/dynatrace_apm/agent/lib64/libdtagent.so=name=agent_name,collector=dtcoldev_new:9998 and nothing after that Currently i'm using sed 's/-agentpath.*//' -i filesThis is removing everything after the agentpath. How can I limit the removal to the string above?
Need help with sed/awk with deleting string
awk;sed