Hi monks, I am trying to search and replace a desired portion from a line using perl but not able to match regex to the end of a word. let me explain the issue below
Line:
0 (0) tracegen chn:req cmd:SDP_CMD_RDSIZED unit:0x10 addr:0x0 len:0x3f + vc:0 qospri:0 qosfw:0 strm:0x0 chain:0 io:0
Code:
$line1 =~ s/addr\:0x.*\S/addr\:$address/;
Result:
0 (0) tracegen chn:req cmd:SDP_CMD_RDSIZED unit:0x10 addr:0x500000000
Unfortunately my code is trimming the rest of the line after addr field which shouldn't happen.
expected result:
0 (0) tracegen chn:req cmd:SDP_CMD_RDSIZED unit:0x10 addr:0x500000000 +len:0x3f vc:0 qospri:0 qosfw:0 strm:0x0 chain:0 io:0
Please suggest a solution to match next white space after addr field or to match end of string and replace. I've tried $, \s, \S, \z, \', etc. But doesn't worked well
2019-05-30 Athanasius added code tags
In reply to search and replace desired portion from a line by syedasadali95
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |