Extract string from brackets February 25, 2023 by Tarik Try this: echo $str | cut -d "[" -f2 | cut -d "]" -f1