I want to replace a specific amount of text after searching for something with the /s function in perl
libpc07 (158.136.80.63) connect to service annek initially as user annek (uid=7186 gid=199) (pid 6117)
This is the string that I have and I want to search for “(” and deleted 15 digits after this to delete the IP address, I also want to do this with the UID afterwords.
The way that I think it is supposed to work is $newvar =~ s/\(\d{15}//g;
but it does not work. I want the text to look like this:
libpc07 connect to service annek initially as user annek
The substitution code would look like:
You may also want to get rid of any trailing white spaces around deleted text, so as not to get double spaces where a deletion occurred, in which case it becomes: