How to write a shell script which uses awk to read in the data file students.txt and output the data in the tabbed format as shown:
Surname Forename MSc Stream Date of Birth
Smith John IT 15.01.1986
Taylor Susan IT 04.05.1987
Thomas Steve MIT 19.04.1986
my answer for the question is as the following, but it doesn't work. Is there any thing missing .. help please.
# do not worry if tabbed columns don’t line up.
# The distance between each of (Surname, Forename, MSc Stream and Date of Birth) column is one tab.
Surname Forename MSc Stream Date of Birth
Smith John IT 15.01.1986
Taylor Susan IT 04.05.1987
Thomas Steve MIT 19.04.1986
my answer for the question is as the following, but it doesn't work. Is there any thing missing .. help please.
Code:
awk 'BEGIN {IFS=" "} {OFS="\t"} {print $1,$2,$3,$4}' students.txt
# do not worry if tabbed columns don’t line up.
# The distance between each of (Surname, Forename, MSc Stream and Date of Birth) column is one tab.
Comment