My question looks ridicilously simple, but:
- I would like to remove an entire string, not a list of characters, so I can't use
tr
. - I don't know the position of my substring, so I can't use
cut
. - I'm not working with regular expressions, but my substring is a namespace, so it does contain dots, so I don't know how to work with
sed
.
The point is the following: I have the following lines:
2023-10-01 15:38:35.2545 | Info | Company.Customer.Server.Communication.Connection.ConnectionManager.SendNextTelegram | Message sent to Server: <HM><ID>25364205</ID><TC>CHR</TC><TR><ID>25906006</ID><DS><ID>GPR5_IN</ID></DS></TR></HM>2023-10-01 15:38:35.6801 | Info | Company.Customer.Server.Communication.Connection.ConnectionManager.OnDataReceived | Telegram received from Server: <HM><ID>25364205</ID><TC>CHR</TC><RT>SUCCESS</RT><RC>0</RC><TR><ID>25906006</ID><DS><ID>GPR5_IN</ID></DS></TR></HM>
I would like to remove the namespace "Company.Customer.Server.Communication.Connection.".
On of the things I tried, is the following:
sed -e 's/"Company.Customer.Server.Communication.Connection.ConnectionManager"/""/g'
(I can imagine you say "But this is freaking easy, just disable regular expressions in sed
", but the manpages only mentions the -r
switch, which causes even more regular expressions to be used.)
Oh, I'm working on a Ubuntu WSL on a Windows computer.