here is what I use in awk language to get

eject   0,0,0   E001420
eject   0,0,0   E001430

awk '{print "eject""\t""0,0,0""\t" $1 }' filename > newoutput.

the curren code below is replacing E strings with eject strings

Derek B. Smith
OhioHealth IT
UNIX / TSM / EDM Teams
614-566-4145





"JupiterHost.Net" <[EMAIL PROTECTED]>
05/26/2004 03:12 PM

 
        To:     [EMAIL PROTECTED]
        cc:     "John W. Krahn" <[EMAIL PROTECTED]>, [EMAIL PROTECTED]
        Subject:        Re: entering text within a file




[EMAIL PROTECTED] wrote:

> ok does this s/^(?=E\d{5})/eject\t0,0,0\t\n/ while <>;
> say...
> 
> from the beginning of the line match 0 or 1 E's with any digits then 
print 

?=E is sort of odd, I think you mean E?
so it is substituting the first part with the second part



s/^E?\d{5}/eject\t0,0,0\t\n/

will take a part of string like E12345 or 12345 and change it to 
eject\t0,0,0\t\n (only once and with an upper case E)

then you need a print statement to print anything.

while(<>) {
  s/^E?\d{5}/eject\t0,0,0\t\n/;
  print;
}

> the eject string?  I am not following the { 5 }. 
> my E string is 6 characters long, so why the 5?

\d{5} says five digits

> isn't there a insert regular expression?
HTH

Lee.M - JupiterHost.Net

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to