Advertisement
Guest User

Untitled

a guest
Apr 16th, 2014
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. echo ${var:position1:lenght}
  2.  
  3. s='myspecificBhost.fqdn.com myspecificaBhost.fqdn.com myspecificzBhost.fqdn.com'
  4. [[ "$s" =~ (B[a-z][a-z][a-z][a-z]) ]] && echo "${BASH_REMATCH[1]}"
  5. Bhost
  6.  
  7. sed -nr '/.*c(.{4,6}).*/s//1/p' input.txt | cut -c2-6
  8. RESULT:
  9. Bhost
  10.  
  11. cat input.txt | grep -o B.... | head -1
  12. RESULT:
  13. Bhost
  14.  
  15. cat file | grep -o B....
  16.  
  17. text='myspecificBhost.fqdn.com myspecificaBhost.fqdn.com myspecificzBhost.fqdn.com'
  18.  
  19. text=${text#*B}
  20. text=${text:0:4}
  21. echo "${text}"
  22.  
  23. host
  24.  
  25. echo "B${text}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement