Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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
- line="11:tcp_listen 1.2.3.4:3478"
- $ line="11:tcp_listen 1.2.3.4:3478"
- $ prefix_with_spaces=${line%%+([^[:space:]])}
- $ echo ">$prefix_with_spaces<"
- >11:tcp_listen <
- $ echo ${#prefix_with_spaces}
- 22
- $ line=$'11:tcp_listentt1.2.3.4:3478'
- $ prefix_with_spaces=${line%%+([^[:space:]])}
- $ echo ${#prefix_with_spaces}
- 15
- $ line="11:tcp_listen 1.2.3.4:3478"
- $ suffix=${line##*[[:space:]]}
- $ echo ">$suffix<"
- >1.2.3.4:3478<
- $ line=$'11:tcp_listentt1.2.3.4:3478'
- $ suffix=${line##*[[:space:]]}
- $ echo ">$suffix<"
- >1.2.3.4:3478<
Add Comment
Please, Sign In to add comment