Hi guys , i have found command to extract the output of a command and save it in a file.
But I want whenever I extract the data from a command , it should start from a particular line ?
I am using this command below to extract data of top command, whenever it repeats it should start from the 6th Line i.e from the PID column but that doesn't happens where am I wrong

top | awk 'BEGIN{print PID"\t"USER"\t"PR"\t"VIRT"\t"RES"\t"SHR"\t"S } {NR==6}{print $2,"\t"$3,"\t"$4,"\t"$5,"\t"$6"\t"$7}' > filename.txt

Plz mind guys, I have not used shell scripts before just need it for one thing
Thanks alot

Use top in batch mode so top -b as opposed to just top