Clark, I agree that %#q is not very intuitive. Stronger said, I HATE it. It lacks flexibility, has no room for future extensions, is not very descriptive and only covers one form of csv while there are MANY variants of CSV, http://en.wikipedia.org/wiki/Comma-separated_values#Lack_of_a_standard tells a bit of the story. There is rfc4180 (http://tools.ietf.org/html/rfc4180) but it lacks wide spread adoption yet and does not help with the millions of existing csv files and software which do not use the syntax of rfc4180.
Olga 2012/4/19 Clark J. Wang <[email protected]>: > 2012/4/19 ольга крыжановская <[email protected]> >> >> Here's one of Roland's old proposals: >> >> RFE: Extend ksh93's printf %q to accept a modifier which defines the >> quoting mode. Supported modes should be: >> >> %(kshliteral)q same as existing %q >> %(shliteral)q quote string with '\' (including spaces) that a POSIX >> shell (and even the old bourne shell) can accept it >> %(xml)q convert string into an xml literal (same as %H) >> %(egrep)q convert string into a literal accepted plainly by egrep >> (e.g. things like '[', ']', '(', ')' etc. are quoted) >> %(grep)q convert string into a literal accepted plainly by grep (e.g. >> things like '[', ']', etc. are quoted) >> %(agrep)q, %(xgrep)q convert string into a literal accepted plainly by >> grep -X/-A (e.g. things like '[', ']', '(', ')' etc. are quoted) >> %(urlencode)q convert string into a literal accepted plainly as URL >> (e.g. space gets encoded as '+', '!' as '%21', '*' as '%2A' etc.) >> The modifers scheme will allow future extensions easily. > > > I like the idea. `%#q' added in 93u+ for CSV format is not very intuitive to > me and `%(csv)q' would look better. :) >> >> >> Comments welcome, I can try to make the patches if David and Glenn >> like the idea. >> >> Olga >> -- >> , _ _ , >> { \/`o;====- Olga Kryzhanovska -====;o`\/ } >> .----'-/`-/ [email protected] \-`\-'----. >> `'-..-| / http://twitter.com/fleyta \ |-..-'` >> /\/\ Solaris/BSD//C/C++ programmer /\/\ >> `--` `--` >> >> _______________________________________________ >> ast-developers mailing list >> [email protected] >> https://mailman.research.att.com/mailman/listinfo/ast-developers > > -- , _ _ , { \/`o;====- Olga Kryzhanovska -====;o`\/ } .----'-/`-/ [email protected] \-`\-'----. `'-..-| / http://twitter.com/fleyta \ |-..-'` /\/\ Solaris/BSD//C/C++ programmer /\/\ `--` `--` _______________________________________________ ast-developers mailing list [email protected] https://mailman.research.att.com/mailman/listinfo/ast-developers
