Afficher un message
Vieux 23/08/2006, 16h38   #5
Stephane Chazelas
Aucun Avatar
 
Messages: n/a
Hébergeur:
Par défaut Re: sed: How do you match a string containing square brackets AND hyphens?

On 23 Aug 2006 08:00:13 -0700, Dave S. wrote:
> The streaming editor (sed) allows us to use the metacharacters "[" and
> "]" to match any one of a number of characters. According to the
> Pattern Matching chapter in O'Reilly's book Unix in a Nutshell by
> Daniel Gilly, "A hyphen or close bracket (]) as the first character is
> treated as a member of the list."

[...]

$ echo '[]-' | sed 's/[][-]/+/g'
+++

See also: sed 'y/[]-/+++/'

--
Stephane
  Réponse avec citation
 
Page generated in 0,05087 seconds with 9 queries