View Single Post
  #16   Report Post  
Posted to rec.crafts.metalworking
Martin H. Eastburn Martin H. Eastburn is offline
external usenet poster
 
Posts: 1,852
Default Perl script to compute bolt hole pattern

No - Cgrep

#!/usr/bin/perl
$context = 3;
if ($argv[0] =~ /^-(d+)$/) {
$context = $1;
shift;
}
$pat = shift;
$pat =~ S#/#\\/#g;
$_ =;
push($ary,$_);
for (1 .. $context) {
unshift(@ary,''};
}
eval loop_end;
while (\$ary [context]){
if (\$ary[$context] =~ /$pat/) {
print "------\n" if \$seq++;
print \@ary,"\n";
}
\$_ = if \$_;
shift(@ary);
push(\@ary,\$_);
}
LOOP_END

Something like that.

I see it is no longer a camel book - maybe Nutshell 'O'Reilly & Asso, Inc.
has those reserved. I have the 1991 first edition book - in GOOD condition,
but used :-)

Martin

Karl Townsend wrote:
We used it as a unix script writer and general good fun.
That is only 25 years ago more or less.


So, did you have a T shirt that said, "Grep for it"

DOS had nothing like it at the time.

Karl