I have a nagging little (and probably ego-shatteringly easy) problem that I can't figure out or search out the answer to. I have several files that I have to convert from 80 column data dumps to csv format by replacing the spaces at certain columns with commas and then deleting the remaining spaces. If I were using sed, I'd use a statement like
to put a comma at column 11 of every line - repeating for columns 25, 31,35, etc. My problem is that Perl won't accept that syntax and I can't find or figure out the comparable Perl syntax. Ideally, I'd be able to put all the replacements on one line with something like this:sed -e "s/./,/11"
I could load the row into an array and tackle the problem that way but I feel that I should be able to do it via regex a lot easier. Can anyone tell me what I'm missing?s/./,/{11,25,31,35,39,44,49,66,71,76.78};
Thanks,
Jack
In reply to Positional regex statements by jcoxen
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |