perl -e 'while (my $var= <STDIN>) { $run ="awk -f work_5messages.awk /home/gprs/newvanu/Hull-r54283_Run/l +ogs/$var >logfile.log" ;`$run`; }'

Take from Re: shell prob, of which I underlined at least a shortcoming.

the above is a (bash)shell script program.....the above code executes $run on the shell only once.....

The above is not a shell script, it' a Perl script. The above executes $run with a different value taken from STDIN each time you feed it something on STDIN, until you end it with CTRL-D.

i want $run to be executed after every 2 sec.....how do i set this timer........

either read perldoc -f sleep or perldoc -f alarm.

and i want this loop to be infinite...but then how can i exit out of it on the prompt.

while (1) { ... }; and I don't understand the prompt thing.

you guys have been very kind to me so far....just one last favor.. vineet

Just one last favour: please do not start new threads for stuff that fits in previous ones!


In reply to Re: looping prob by blazar
in thread looping prob by vineet2004

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.