Tuesday, October 11, 2011

solaris's sed(1) hanging on word boundary replacements

Couldn't find a bug ID for this one, although I didn't look very hard.

Any replacements on word boundary \< \> will hang if the s/// is a non-word boundary char i.e. [^a-zA-Z0-9_]

echo foo | sed 's/\</a/g'


is OK

echo foo | sed 's/\</#/g'


is not.

Workaround is to use /usr/xpg4/bin/sed.

UPDATE: Bug # 7107401 has been logged for this kind of behavior with sed command.

No comments: