Skip to main content
1 of 2

adding delimiter to a string

Hey guys i am in a bit of a jam. Quick backstory i am extracting ascii data from network packages captured by tcpdump. I have manipulated the data to the point i am on a single string and now need to cut it. The problem the left over string has the package header followed by the ascii data.

A string example is +%_!^0r,zK"5÷fgf/Nametoextractanothernametoextracthostname1.1.1.12.1iwm876

Now the names to extract can change and be different. The hostname is the the variable i am using a constant. I want to add a delimiter in front of the host name so i can then use cut to remove the junk at the end of the string.

An example would be of the desired result

+%_!^0r,zK"5÷fgf/Nametoextractanothernametoextract:hostname1.1.1.12.1iwm876

So i can then use cut to get this output

Nametoextract anothernametoextract