$ cat Lines.txt | raku -e '.say for lines()[3,2,5]'

On Mon, Aug 24, 2020 at 11:08 PM ToddAndMargo via perl6-users
<perl6-us...@perl.org> wrote:
>
> On 2020-08-24 19:35, ToddAndMargo via perl6-users wrote:
> > Hi All,
> >
> > I seems I should know how to do this, but
> > I am drawing a blank.
> >
> > $ cat Lines.txt | raku -ne 'say $_;'
> > Line 1
> > Line 2
> > Line 3
> > Line 4
> > Line 5
> > Line 6
> > Line 7
> > Line 8
> > Line 9
> > Line 10
> > Line 11
> >
> >
> > I want to print liens 1, 3, and 7.
> >
> > Assigning  `my @x=$_.lines` puts everything into $x[0]
> >
> >
> > Many thanks,
> > -T
>
> This is what I have so far:
>
> $ cat Lines.txt
> Line 0
> Line 1
> Line 2
> Line 3
> Line 4
> Line 5
> Line 6
> Line 7
> Line 8
> Line 9
> Line 10
> Line 11
>
> $ cat Lines.txt | raku -e ' my @x=$*IN.lines; for @x[3,2,5] {say $_};'
> Line 3
> Line 2
> Line 5
>
>
> is there a quicker way to get to the point?
>
> Many thanks,
> -T

Reply via email to