T
toomanyjoes
I'm still having problems opening a file. I looked at the docs and this
is what I came up with.
open (FILE, "> C:\notes\gen.txt") || die ("error $!\n"); #See note 1
while (<FILE>) { #See note 2
s/\<[NR][a\d]\>/ /g #note 3
if (^\w\D\D\s\d+:\d+) #note 4
Note1: Although in all the examples I've looked at the actual file
reference is always very vague and I have never seen a full path with
the files extension in the quotes like I have done here.
Note2: Here I want to loop through the file, is this correct?
Note3: Here I want to find every instance (In the File) of a "<Ra> or a
<N1>(2,3,etc.)" and replace it with nothing (basically remove it)
Note4: Here I'm looking for a specific arrangement of characters at the
beginning of the line it can be any character followed by 2 letters
followed by a space followed by any number of digits separated by a
colon. (ex. 1RA 12321:123214 would match as well as ADD 4:2) if a match
occurs I want to remove the colon and separate these items with a
delimiter. For Example (ex. 1RA/ 12321/123214)
And thats as far as I've been able to get because I get an error
opening the file. It looks to me like I've done it by the book. But I
must be missing something. I'd appreciate any comments about my code.
Thanks,
Joe
is what I came up with.
open (FILE, "> C:\notes\gen.txt") || die ("error $!\n"); #See note 1
while (<FILE>) { #See note 2
s/\<[NR][a\d]\>/ /g #note 3
if (^\w\D\D\s\d+:\d+) #note 4
Note1: Although in all the examples I've looked at the actual file
reference is always very vague and I have never seen a full path with
the files extension in the quotes like I have done here.
Note2: Here I want to loop through the file, is this correct?
Note3: Here I want to find every instance (In the File) of a "<Ra> or a
<N1>(2,3,etc.)" and replace it with nothing (basically remove it)
Note4: Here I'm looking for a specific arrangement of characters at the
beginning of the line it can be any character followed by 2 letters
followed by a space followed by any number of digits separated by a
colon. (ex. 1RA 12321:123214 would match as well as ADD 4:2) if a match
occurs I want to remove the colon and separate these items with a
delimiter. For Example (ex. 1RA/ 12321/123214)
And thats as far as I've been able to get because I get an error
opening the file. It looks to me like I've done it by the book. But I
must be missing something. I'd appreciate any comments about my code.
Thanks,
Joe