Guest User

Untitled

a guest
Sep 18th, 2018
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. 11:tcp_listen 1.2.3.4:3478
  2. 12:tcp_listen [::1]:3478
  3. 13:tcp_listen [2600:2700:2800:2900:3000:3100:3200:3300]:3478
  4.  
  5. line="11:tcp_listen 1.2.3.4:3478"
  6.  
  7. $ line="11:tcp_listen 1.2.3.4:3478"
  8. $ prefix_with_spaces=${line%%+([^[:space:]])}
  9. $ echo ">$prefix_with_spaces<"
  10. >11:tcp_listen <
  11. $ echo ${#prefix_with_spaces}
  12. 22
  13.  
  14. $ line=$'11:tcp_listentt1.2.3.4:3478'
  15. $ prefix_with_spaces=${line%%+([^[:space:]])}
  16. $ echo ${#prefix_with_spaces}
  17. 15
  18.  
  19. $ line="11:tcp_listen 1.2.3.4:3478"
  20. $ suffix=${line##*[[:space:]]}
  21. $ echo ">$suffix<"
  22. >1.2.3.4:3478<
  23. $ line=$'11:tcp_listentt1.2.3.4:3478'
  24. $ suffix=${line##*[[:space:]]}
  25. $ echo ">$suffix<"
  26. >1.2.3.4:3478<
Add Comment
Please, Sign In to add comment