Monday, November 8, 2010

Sed Grouping and BackReference - PART-2

Example :

echo "[asd] [qwe] [zxc]"
[asd] [qwe] [zxc]

echo "[asd] [qwe] [zxc]" | sed -e "s/\[\(\(.\)*\)\]/\<\1\>/g"


echo "[asd] [qwe] [zxc]" | sed -e "s/\[\([^[]*\)\]/\<\1\>/g"


part in red color makes the difference. :P

No comments:

Post a Comment