Below is the extract of one file where there are many similar entries.
I want to replace a pattern starting with managed and ending with second .com ( for example "managed_server_lonlx20491.example.com_2_lonlx20491.example.com") with only "managed".
i.e. final output should look like this
| weblogic | bakejo | email@example.com | firstname.lastname@example.org | managed:8380 | managed:8380 |
| weblogic | bakejo | email@example.com | firstname.lastname@example.org | lonlx10404.example.com | lonlx20491.example.com |
I tried to use sed
$sed -ne 's/managed_server_*_2_*.com/managed/p' file1
which did not work
. I am sure taht I am not using correct regex. Please help.