I am writing a Bash script and I would like to find the end position of the whitespace in multiple strings. I can't just search for spaces, because it might have tabs in it. Below are a few examples of lines I might search.
11:tcp_listen 1.2.3.4:3478
12:tcp_listen [::1]:3478
13:tcp_listen [2600:2700:2800:2900:3000:3100:3200:3300]:3478
- First Line: Whitespace Ending Position: 21
- Second Line: Whitespace Ending Position: 26
- Third Line: Whitespace Ending Position: 24
I am looping through each line, and have each line as a variable.
Example:
line="11:tcp_listen 1.2.3.4:3478"