Loosing formatting when echoing an awk script

  1. The problem statement, all variables and given/known data:
    When I echo out the output of my awk script I loose the formatting
    that I set in my awk script (it should be in a table format).

  2. Relevant commands, code, scripts, algorithms:

  3. The attempts at a solution (include all code and scripts):

 
set dir = $1
    foreach file ($dir/*)
        set output =  `awk -f /home/alex/Desktop/aal $file `
        echo $output
        printf "\n"
    end
   
  1. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
    Why?
    Southampton University, UK, Paul Lewis, G400

You don't need to save it into a variable at all. If you don't redirect it, the code will print to the stdout of your script without interference.

set dir = $1
    foreach file ($dir/*)
        awk -f /home/alex/Desktop/aal $file
        printf "\n"
    end

It's messing up your formatting because of how your shell processes text before feeding it into echo, splitting things apart on whitespace etc. The answer is to not do that. :wink:

Something to do with proving your intentions I think. We've had quite a lot of people use these forums to cheat. At least homework's not banned entirely anymore, hm? :wink:

Thank you very much. Yes, I wasn't aware you could call commands directly - it is the first shell script I've ever written you see and my lecturer is useless.