Question: I want parse something like a section entry in an \*.ini file:

```
line='      [          fdfd fdf         f   ]  '

```

What could be the sed pattern (???) for this line to split the

```
'fdfd fdf         f'

```

out?

So:

```
echo "${line}" | sed -E 's/???/\1/g'

```

How can I describe all chars except `[[:space:]]`, `[` and `]` ? This doesn't work for me: `[^[[:space:]]\[]*` .

Answer: 
```
$ echo "$line" | sed "s/^.*\[[[:space:]]*\([^]]*[^][:space:]]\)[[:space:]]*\].*$/'\1'/"

```

You can split the pattern into two:

```
$ echo "$line" | sed "s/^.*\[[[:space:]]*/'/; s/[[:space:]]*\].*$/'/"

```

`awk` works too:

```
$ echo "$line" | awk -F' *[[\]] *' -vQ="'" '{print Q$2Q}'

```
When you say split, do you mean *split into an array*, or do you mean *filter* out all spaces and brackets?

Assuming the value of line number 1 in file.ini is:

```
  [          fdfd fdf         f   ]  

```

If you mean array,

```
$linenumber=1;
array=($(sed -n ${linenumber}p file.ini | sed 's/[][]*//g'));

```

will split line number 1 of file.ini into an array and return the values:

```
${array[0]} = fdfd
${array[1]} = fdf
${array[2]} = f

```

If you mean filter spaces and brackets,

```
$linenumber=1;
sed -n ${linenumber}p file.ini | sed 's/[ []]*//g';

```

will return:

```
fdfdfdff

```

and if *neither of those* is what you meant, **please specify the exact output** you are looking to extract from the initial value so that we can address it correctly.