How to extract 3rd,4th and 5th element

Hi All!

I trying to execute this perl script to extract a particular field in a text file, luckily it works. But, right now I would like to extract 3 more fields in the text file but couldnt get the right syntax on how to do it.
command is:

perl -pe '$_ = (split(/[ \n]/)) [0] . "\n"' TestDoc.txt ---> extracts only the first field in the text file.

Sample Data:

    -f sss vvvv 6765 /etc/password 2011201 wwwwww
    -f sss vvvv 7777 /usr/share 2011201 wwwwww
    -f sss vvvv 8888 /home/bin 2011201 wwwwww

ANy help would be gladly appreciated. TIA.

For example:

 perl -ple '$_ = join(" ",(split(/\s+/)) [1,3..6])."\n" '  TestDoc.txt

In this case you should use:

 perl -ple '$_ = join(" ",(split(/\s+/)) [3,4,5])."\n" ' TestDoc.txt

This can also be done with awk.

$ awk '{print $3 " " $4 " " $5}' awktest 
vvvv 6765 /etc/password
vvvv 7777 /usr/share
vvvv 8888 /home/bin

Hi all,

million thanks to those who provided the solution.