why my shell script doesn't work!!

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lawazad
    New Member
    • Apr 2011
    • 1

    why my shell script doesn't work!!

    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.

    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.
  • sicarie
    Recognized Expert Specialist
    • Nov 2006
    • 4677

    #2
    What is wrong with it? What is the current output?

    My first guess is that you're not using the correct whitespace marker (your script catches just a space, not space/tab/EOL/other...) but that's without knowing what the current output is.

    Comment

    Working...