D&C Lug - Home Page
Devon & Cornwall Linux Users' Group

[ Date Index ][ Thread Index ]
[ <= Previous by date / thread ] [ Next by date / thread => ]

Re: [LUG] regexp?



On Monday 13 May 2002 09:19, you wrote:

c) let them be formatted in any olf format and still find them

$number = mygetfield();
$number =~ s/\D//g;
$number =~ s/(\d{3})(\d{3})(\d{4})/$1 $2 $3/;

the third is the one, and what i want is to pull the lines for an individual 
patient out in order to see who is due for what, grab the original referral 
letter and so on.

Meanwhile I have been looking at extracting insurance reports and at present 
have come up with 
cat 0512*|sed 's/^\([0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9]\)  
\([A-Z].*\)  \([0-9][0-9]\/[0-9][0-9]\/[0-9][0-9][0-9][0-9]\)/\3  entered  \1 
\2/'


which pulls one lot of info out, and another similarly long bit of egrepery 
that pulls out another lot, and what I caleld a halt at was running one, up 
to the point in a file where a particular and absolutely reliable line of 
text occurs, then saving the filtered text _before that_ and appending the 
text _after it_ filtered through the second expression.

Fascinating stuff in these text filtering tools.


-- 
From one of the Linux desktops of Dr Adrian Midgley 
http://www.defoam.net/             

--
The Mailing List for the Devon & Cornwall LUG
Mail majordomo@xxxxxxxxxxxx with "unsubscribe list" in the
message body to unsubscribe.


Lynx friendly