[Solved] How to get the specific data in a file and direct its output to to new file?


The following awk script should solve your probelm provided you manually add the School heading yourself or if that remains same add it as BEGIN { printf "School" } in below example.

$ cat input_file 
Mark,Texas High, Dallas, k-5
Steve,SA high,Antonio,k-5
Adam,Plano tech,k-5

$ awk -F, 'BEGIN { sep = ""} { printf("%s%s", sep, $2); sep = ","}' < input_file 
Texas High,SA high,Plano tech

solved How to get the specific data in a file and direct its output to to new file?