I have a file with many lines. Below I'm highlighting only those line that concerns me from the file.
....
drwxr-xr-x 4 user1 dba 20480 Feb 25 20:38 /tmp/10203/cust/01
....
drwxr-xr-x 4 user1 dba 20480 Feb 25 20:38 /tmp/10203/cust/01/logs/mtr
....
drwxr-xr-x 4 user1 dba 20480 Feb 25 20:38 /tmp/10203/cust/03/src/files
drwxr-xr-x 4 user1 dba 20480 Feb 25 20:38 /tmp/10203/cust
....
I requirement is to append this string <font color=yellow> and add this string </font> at the end of the found string on the same line.
Thus, if we consider "/tmp/10203/cust/01" the desired output should be changes to the line with the exact match. <font color=yellow>drwxr-xr-x 4 user1 dba 20480 Feb 25 20:38 /tmp/10203/cust/01</font>
It should not affect the superset string like this one "drwxr-xr-x 4 user1 dba 20480 Feb 25 20:38 /tmp/10203/cust/01/logs/mtr"
I know how to add text before and after the matched string on new line but i do not know how to on the same line with the exact match.
Below is what i tried:
sed 's/\b\/tmp\/10203\/cust\/01\b/& <\/font>' filename
But it adds the text to a superset string i.e does not exact match.