Re: I need help with "lines"

2019-03-16 Thread ToddAndMargo via perl6-users
On 3/15/19 6:38 PM, ToddAndMargo via perl6-users wrote: On 3/14/19 10:05 PM, Todd Chester via perl6-users wrote: Hi All, What am I doing wrong here? ps ax | grep [f]irefox | perl6 -ne 'my @x = $_.words[0].lines.reverse; print @x[0] ~ "\n";' 7380 7581 7698 13023 13767 13908 Two problems: 1

Re: I need help with "lines"

2019-03-15 Thread ToddAndMargo via perl6-users
On 3/14/19 10:05 PM, Todd Chester via perl6-users wrote: Hi All, What am I doing wrong here? ps ax | grep [f]irefox | perl6 -ne 'my @x = $_.words[0].lines.reverse; print @x[0] ~ "\n";' 7380 7581 7698 13023 13767 13908 Two problems: 1) "lines" is putting everything into @x[0] 2) "reverse"

Re: I need help with "lines"

2019-03-15 Thread Todd Chester via perl6-users
On 3/15/19 7:58 AM, Todd Chester via perl6-users wrote: Never did figure out why everything went into @x[0] The entire pipe gets put into @x[0]. @x[1] is uninitialized

Re: I need help with "lines"

2019-03-15 Thread Peter Pentchev
On Fri, Mar 15, 2019 at 07:52:57AM -0700, Todd Chester via perl6-users wrote: > > > On 3/15/19 2:52 AM, Peter Pentchev wrote: > > 1. Learn to use pgrep instead of the myriad variations of ps | grep; > > pgrep has been standardized by POSIX for a long time and is almost > > certainly avail

Re: I need help with "lines"

2019-03-15 Thread Peter Pentchev
On Fri, Mar 15, 2019 at 07:58:11AM -0700, Todd Chester via perl6-users wrote: > > > On 3/15/19 3:02 AM, Peter Pentchev wrote: > > On Fri, Mar 15, 2019 at 11:52:15AM +0200, Peter Pentchev wrote: > > [snip] > > > 3. The standard input stream in Perl 6 is called $*IN (think of it as > > > mostly

Re: I need help with "lines"

2019-03-15 Thread Todd Chester via perl6-users
On 3/15/19 3:02 AM, Peter Pentchev wrote: On Fri, Mar 15, 2019 at 11:52:15AM +0200, Peter Pentchev wrote: [snip] 3. The standard input stream in Perl 6 is called $*IN (think of it as mostly equivalent to what <<>> and <> would read from in Perl 5, ...sorry about this part, I know it's n

Re: I need help with "lines"

2019-03-15 Thread Todd Chester via perl6-users
On 3/15/19 2:52 AM, Peter Pentchev wrote: Hope that helped! G'luck, Peter [1] The "almost certainly" is because, yes, yes, I know, I also have that dusty old HP/UX crunching away in a customer's basement; still. Yes it does. Thank you! I remember zsh for my Solaris days. Or at leas

Re: I need help with "lines"

2019-03-15 Thread Todd Chester via perl6-users
On 3/15/19 2:52 AM, Peter Pentchev wrote: 1. Learn to use pgrep instead of the myriad variations of ps | grep; pgrep has been standardized by POSIX for a long time and is almost certainly available in all the installations that you will ever need to touch[1]. pgrep is interesting

Re: I need help with "lines"

2019-03-15 Thread Todd Chester via perl6-users
On 3/15/19 2:35 AM, Simon Proctor wrote: All looking good so far. what is it you're wanting from this data? Hi Simon, Thank you! What this is for is a backup routine. I am checking for the highest instance of any jammed running instances of [xfa]dump. If I find any, I "kill -9" it and wa

Re: I need help with "lines"

2019-03-15 Thread Peter Pentchev
On Fri, Mar 15, 2019 at 11:52:15AM +0200, Peter Pentchev wrote: [snip] > 3. The standard input stream in Perl 6 is called $*IN (think of it as >mostly equivalent to what <<>> and <> would read from in Perl 5, ...sorry about this part, I know it's not correct. > and pretty much the same thing

Re: I need help with "lines"

2019-03-15 Thread Peter Pentchev
On Thu, Mar 14, 2019 at 11:14:17PM -0700, Todd Chester via perl6-users wrote: > > > On Fri, 15 Mar 2019, 05:34 Todd Chester via perl6-users, > > > mailto:perl6-us...@perl.org>> wrote: > > > > > > > > > > > > On 3/14/19 10:05 PM, Todd Chester via perl6-users wrote: > > > > Hi All, > > >

Re: I need help with "lines"

2019-03-15 Thread Todd Chester via perl6-users
On 3/14/19 10:05 PM, Todd Chester via perl6-users wrote: Hi All, What am I doing wrong here? ps ax | grep [f]irefox | perl6 -ne 'my @x = $_.words[0].lines.reverse; print @x[0] ~ "\n";' 7380 7581 7698 13023 13767 13908 Two problems: 1) "lines" is putting everything into @x[0] 2) "revers

Re: I need help with "lines"

2019-03-15 Thread Simon Proctor
Ok so in this kind of situation I tend to break it down into smaller stages so : ps ax | grep [f]irefox 4277 tty2 Sl+1:08 /usr/lib/firefox/firefox 4780 tty2 Sl+2:44 /usr/lib/firefox/firefox -contentproc -childID 1 -isForBrowser -prefsLen 1 -prefMapSize 177920 -schedulerPrefs 0001

Re: I need help with "lines"

2019-03-14 Thread Todd Chester via perl6-users
On Fri, 15 Mar 2019, 05:34 Todd Chester via perl6-users, mailto:perl6-us...@perl.org>> wrote: On 3/14/19 10:05 PM, Todd Chester via perl6-users wrote: > Hi All, > > What am I doing wrong here? > > ps ax | grep [f]irefox | perl6 -ne 'my @x = $_.words[0].lines.re

Re: I need help with "lines"

2019-03-14 Thread Simon Proctor
6am here and I'm not at a computer but I think your problem is trying to use both -n which runs your code on each line of STDIN and lines. Try one or the other see what happens. Once I'm ambulant and at a computer I'll poke at it myself. On Fri, 15 Mar 2019, 05:34 Todd Chester via perl6-users, <

Re: I need help with "lines"

2019-03-14 Thread Todd Chester via perl6-users
On 3/14/19 10:05 PM, Todd Chester via perl6-users wrote: Hi All, What am I doing wrong here? ps ax | grep [f]irefox | perl6 -ne 'my @x = $_.words[0].lines.reverse; print @x[0] ~ "\n";' 7380 7581 7698 13023 13767 13908 Two problems: 1) "lines" is putting everything into @x[0] 2) "revers