Re: sed: How do you match a string containing square brackets ANDhyphens?
Dave S. wrote:
> Jon,
>
> No, the O'Reilly book didn't say anything about making a hyphen the
> last character to escape its meaning. I'll try that.
>
> But that still leaves the opening square bracket to be dealt with. What
> about it?
>
> Thank you.
>
>
> Jon LaBadie wrote:
>
>> If the backslash, '\' were an escape character inside brackets
>> it might work. But it is not and escape character in that context.
>>
>> The O'Reilly book also said, or should have said, a hyphen as the
>> first or the last character is treated as a member of the list.
>> So you could do []xyz-] to make a list matching 5 characters.
>
The opening bracket can be anywhere in the list.
|