Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- echo ${var:position1:lenght}
- s='myspecificBhost.fqdn.com myspecificaBhost.fqdn.com myspecificzBhost.fqdn.com'
- [[ "$s" =~ (B[a-z][a-z][a-z][a-z]) ]] && echo "${BASH_REMATCH[1]}"
- Bhost
- sed -nr '/.*c(.{4,6}).*/s//1/p' input.txt | cut -c2-6
- RESULT:
- Bhost
- cat input.txt | grep -o B.... | head -1
- RESULT:
- Bhost
- cat file | grep -o B....
- text='myspecificBhost.fqdn.com myspecificaBhost.fqdn.com myspecificzBhost.fqdn.com'
- text=${text#*B}
- text=${text:0:4}
- echo "${text}"
- host
- echo "B${text}"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement