BEGIN{ FS="|" }FNR==1{ for(i=1;i<=NF;i++){ if($i=="Marks"){ field=i } } next}{ print $field}
RollNo|Name|Marks 123|Raghu|80 342|Maya|45 561|Gita|56 480|Mohan|71
80 45 56 71
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!