Skip to main content
Formatting and tags
Source Link
jasonwryan
  • 74.8k
  • 35
  • 204
  • 230

adding Adding delimiter to a string

Hey guys i am in a bit of a jam. Quick backstory iI am extracting ascii data from network packages captured by tcpdumptcpdump. I have manipulated the data to the point iI 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

+%_!^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 iI am using a constant. I want to add a delimiter in front of the host name so iI 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

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

So iI can then use cut to get this output:

Nametoextract anothernametoextract

Nametoextract anothernametoextract

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

Adding delimiter to a string

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
Source Link

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