После awk
может также помочь вам в том же.
awk -F"[][]" 'NF{print $2}' Input_file
Объяснение: следующий код не является точным, он используется только для пояснения.
-F"[][]" ##Setting field separator as ] and [ for each line in Input_file.
'NF{ ##Checking condition here if line is NOT NULL where NF is number of fields awk variable which will be set only when a line is NOT NULL.
print $2} ##If above condition is TRUE then print the 2nd field of current line of Input_file.
' Input_file ##Mentioning Input_file name here.