jhintu jhintu - 26 days ago 5x
Bash Question

Extract string using : as delimiter in shell

I have a string

"inet6 addr: 2620:cb:0:b007::23c3/112 Scope:Global",

and I want to extract only


from the above string.

How can I extract the substring using cut/sed/awk command.


I am too new in shell but with cut command, it would be like:

   cut -f2-7 -d":" | cut -f1 -d "/"