This is probably a very simple question, but I'm only in my first few days of perl programming. I'm an economist trying to fix some data that did not use negative signs but rather used letters to represent negative numbers. The data is organized in such a way that these values fill spaces that are five characters long, and there are many of them (thousands of columns by thousands of rows). I want a program that will replace them, but not a simple find-and-replace substitution. I rather need to tell perl to look at an individual string of five columns, and the next one. that is to say
OOOOOOOOOJ
is really the same as:
OOOOOJOOOO
I think there are other weird data entries. And I need to convert these in chunks. that is to say, I don't want every J to be -1, I rather need to give instructions to convert the rows between 955 and 959 to -0001 if it contains a J anywhere in that block. I have a dictionary that identifies tbe blocks (they are not all equally long) in Stata. I think I might be able to use it again. Does anyone have ideas as to an easy way to do this?
The force is not so much with me when it comes to perl (though I'm learning!).
In reply to Find and replace by five character string by wrml
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |