DervishD <[EMAIL PROTECTED]> writes: > expr substr "x$string" $tmpindex 1 > > If I need to translate this in a pattern matching expression, I > must calculate the number of 'dots', because I'm not sure if the > '{N}' syntax (to match exactly '{N}' times) is portable enough.
You're right to worry, I suspect it wouldn't be portable to sufficiently-ancient hosts (e.g., 4.2BSD). However, it is standardized by POSIX 1003.1-1992. You need backslashes in front of the braces, though. E.g.: expr "X$string" : 'X.\{3\}\(.\)' outputs the 4th character in "$string" (origin-1). > (I don't have access to a POSIX standard so I've chosen SUS > as my standard base). POSIX is available free of charge on the web, here: http://www.unix.org/single_unix_specification/ You are supposed to register, but access is free after that. _______________________________________________ Bug-coreutils mailing list [EMAIL PROTECTED] http://lists.gnu.org/mailman/listinfo/bug-coreutils