Re: Translate sed / Perl

2004-08-13 Thread Boris Zentner

Hi,

Am Freitag, 13. August 2004 15:19 schrieb Errin Larsen:
> Hey guys (and gals, I imagine!),
>
> I'm really new to perl. I've been working through some beginners
> tutorials and now I need (want!) to use perl to overhaul something I
> wrote in the past.  I've got a script (in bash) that I use that has a
> particular sed command in it.  The command is as follows:
>
>  sed -n '/System Temperatures/,/==*/p' FILENAME
>

perl -ne 'print if /^System Temperatures/ .. /^==*/' FILENAME

> The file in question has text that looks like this:


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: Match the first 3 characters of 2 words?

2003-12-11 Thread Boris Zentner

Hi,

Am Mittwoch, 10. Dezember 2003 21:19 schrieb Rod:
> What is the easiest way to test the first 3 characters of two words for
> a match.
>
> IE:  "dasf" test "dasg" to return positive.
>
>
> rod.

# return true, if the words differ
return unpack( "%32C3", $w1 ^ $w2 );
-- 
Boris

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
 




Re: OpenInteract and others

2002-04-26 Thread Boris Zentner

Hi,
>
>   I hope this is the appropriate forum for this question.
>
>   I have been looking for a pretty good base system for which to build
>   a portal system. (messages, news, other content, weather)
>

Look at PageKit http://www.pagekit.org

-- 
cu boris

Letzte Worte eines Handgranatenwerfers:
  "Bis wieviel sagten Sie soll ich zählen?"

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: regex question

2002-03-13 Thread Boris Zentner

Hi Martin,

>
>
> i have a long text file. in this text file several strings of the form: 
> ### filename.jpg ### are embedded.
>
> how should a regex look that takes following:
>
>  ### filename.jpg ### 
>
> and returns
>

try this.

s/### (\w+\.jpg) ###//;

the filename is in $1


>  
>
> and the filename.jpg saved in a $
>
> :o)
>
> martin

-- 
cu boris

Wenn ich nur mehr Zeit gehabt hätte, hätte ich Dir einen kürzeren
Brief geschrieben.
  -- Pascal

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: Finding words between words...

2002-03-11 Thread Boris Zentner


Hi,

> I have some text here that I have placed in a string.  I want to be able
> to extract words between text of my choice.  For example in the
> string...
>
> $string = "Hello world In: crud all Your.";
>
> ($mytext) = $string =~ /In:(.*)Your/;
>
> The above works fine but how can I tell my regex to stop as soon as it
> finds these words.  For example if in the string...
>
> $string = "Hello world In: crud all Your. hello again In: crud aagin
> Your at the...";
>
> The regex above will go crazy?

To find the minimal pattern use:

($mytext) = $string =~ /In:(.*?)Your/;

-- 
cu boris

Es ist schöner, eine schöne Gegend zu betrachten als zu betreten.
  -- Jean Paul

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: help with my parser program?

2002-03-09 Thread Boris Zentner


Hi,

i suggest to use Text::Wrap.

Also you can type this maybe it is what you want.

perl -ne 'print "$1\n" while (/\s*((?:.{1,78})|\S+)\b/g)' < your_text.txt

Am Samstag, 9. März 2002 19:42 hast Du geschrieben:
> could someone please help me make this bit of code
> more efficient?  I am trying to break really long
> lines, say up to 600 characters into manageable sizes
> (78 or less characters) but I do not want to break
> cleanly at position 78.  If that is in the middle of a
> word, my program back steps to the first whitepace.
>
> but I think I am overdoing it here, although it seems
> to give me the results I want.
>
> I would not like to use a module for this, but rather
> have it hard coded myself.  Please help me without
> module advice if possible

-- 
cu boris

Frage an Radio Eriwan: "Stimmt es, daß in den USA jeder ein Auto hat?"
Antwort: "Im Prinzip ja, aber bei uns hat dafür jeder einen Parkplatz." 

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]




Re: reading a text file

2001-07-24 Thread Boris Zentner

hi Debbie,

perhaps this is what you want.

#!/usr/bin/perl -w
use strict;

open STATES, ") {
  $num =~ s/^\s+//;
  $num =~ s/\s+$//;
  push @{ $states{$num} }, $state;
}

for (keys %states) {
  print "$_ ", join ( ',', @{ $states{$_} } ), "\n";
}



Am Dienstag, 24. Juli 2001 21:03 schrieb Debbie Christensen:
> I am brand new to perl; I am only on chapt 4 of the learning perl book.  My
> boss has already given me a project to do that I am really struggling with.
> I know you are all really busy, but I would really appreciate any help you
> can give.
>
> I have a text file that looks something like this
>
> OH:  702
> PA: 702
> ND: 702
> NJ :703
> NY: 703
> Ca: 703
>
>
> #my simple program
>
> open(STATES,"state.txt")||
> die "can't open state:";
> while ($line = )
> {
> print $line;
> }
> close STATES;
>
>
> I am able to open the file and read it with no problem.  Where I get lost
> is My boss wants the data to come out like
> 702 OH, PA, ND
> 703 NJ, NY, CA
>
> I have looked up Faq questions and have looked through my books.  I have
> even tried formating it with no luck.  Any help you can give would be
> great.
>
>
>
>
>
>
> Thanks,
> Debbie Christensen

-- 
cu boris

Man hört, wegen der Gewöhnlichkeit, das Prügelgeschrei eines Kindes
mit weniger Rührung als eines Hunds.
  -- Jean Paul

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]