How Reorganize Data From Text File Setting a Delimiter

Hello mates, I am trying to reorganize data from a .txt file defining delimiters. Example of data:

password 0.0.3

I am trying to split this data tracking blank spaces and five bytes after the : symbol to save it into different variables. Exactly like shown below.

key = password
node = 0.0.3 
address1 =
tls1 = 50211
address2 =
tls2 = 50212


   content, err := ioutil.ReadFile(title)
	   if err != nil {
	data := strings.Split(string(content), ":")

Nevertheless strings.Split(string, ":") actually delete the delimiter instead of working as a starting point to crop the text.

Hi, I just starting by using blank as separator to get key and node. Then use the other token like input for the second pass, and then use “:” as separator.
Please check as an example (remember to add error handling :slight_smile:

1 Like

Thank you so much.

It is exactly what I was looking for