the last mail was the solution! Thanks for the persistence!
the code is to insert eject 0,0,0 string in front of the E string like so:
eject 0,0,0 E4030
from a file that contains just E strings
#!/usr/local/bin/perl -w
use strict;
my $ejectapes = qw(/usr/local/bin/perld/exports);
($^I, @ARGV) = (".bak", "$ejectapes");
while (<>) {
s/(^E?\d{5})/eject\t0,0,0\t$1\n/;
print;
}
or as in awk:
awk '{print "eject" "\t" "0,0,0" "\t" $1}'
Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
"JupiterHost.Net" <[EMAIL PROTECTED]>
05/26/2004 05:40 PM
To: [EMAIL PROTECTED]
cc: [EMAIL PROTECTED], "John W. Krahn" <[EMAIL PROTECTED]>
Subject: Re: entering text within a file
[EMAIL PROTECTED] wrote:
> awesome.... I am making progress. I used ".bak" instead of ' ' b/c I do
> not want to remove the file after $ ^ I the edit is done.
> BUT,
>
> I do not want to replace the E strings with the eject string instead I
> want to put the eject string in from of the E string and write now it is
> replacing ?
Try this:
while(<>) {
s/^E?\d{5}/eject\t0,0,0\t\n\1/; # the \1 is what you matched in the
first half
print;
}
> thanks!
np :)
Lee.M - JupiterHost.Net