각 레코드에는 열 이름이 있습니다. 다음과 같이 각 레코드에서 이를 교체해야 합니다.
TIME=20181219110000275|CHAN=FMBKHJBAAAADPCFNAAAAAABA|EVNT=SWIgrld|API=SWIrecGrammarActivate|TYPE=uri/2.0|URI=http://media-elr/en-us/grammar/PRVS05/PRVS_param_gram.grxml?SWI.appsessionid=00053050771545238465&SWI.appstepid=1|WGHT=1|PROPS=inet.timeoutDownload=5000;inet.timeoutIO=5000;inet.timeoutOpen=5000;inet.urlBase=http://vxml3-elr:7000/CVP/;swirec_language=en-US|FETCHES=0|MEMHITS=1|MEMMISS=0|DISKHITS=0|DISKMISS=0|LDCPU=0|LDTIME=1|GCCPU=0|GCTIME=0|IFCPU=0|IFTIME=0|IFBYTES=0|COMPILES=0|RC=0|UCPU=186093|SCPU=30828
출력은 다음과 같아야 합니다.
20181219110000275|FMBKHJBAAAADPCFNAAAAAABA|SWIgrld|SWIrecGrammarActivate|uri/2.0|http://media-elr/en-us/grammar/PRVS05/PRVS_param_gram.grxml?SWI.appsessionid=00053050771545238465&SWI.appstepid=1|1|inet.timeoutDownload=5000;inet.timeoutIO=5000;inet.timeoutOpen=5000;inet.urlBase=http://vxml3-elr:7000/CVP/;swirec_language=en-US|0|1|0|0|0|0|1|0|0|0|0|0|0|0|186093|30828
답변1
string='abc=something|efgh=anotherThing|klmnop=yet_another_thing'
string='|'$string #to prepend with '|' and have a pattern
result=$( echo "$string" | sed 's/|[a-zA-Z]*=/|/g' )
result=${result:1} # remove the leading '|' we added
something|anotherThing|yet_another_thing