Question: I'm trying to generate a summary report in bash. My text file format's this way:

```
title:composer:price:musical pieces available:musical pieces sold

```

However, in my report output's supposed to be this way :

```
Title       Composer   Price   PiecesAvail   PiecesSold   TotalProfit
Graham      Jack       20.00       10            2           40.00
Zack        Squall      4.00       5             3            7.00

```

Anyone can point me in the right direction? I would have to either calculate the total profit beforehand,or while generating the report.

A sample of the textfile's here:

```
 Graham:Jack:20.00:10:2
 Jack:Squall:4.00:5:3
 Random - One:Jim:5.00:4:1
 RainyDay:Melissa:50.00:2:1

```

I've not thought how to calculate the total profit yet though.

Answer: 
see if this is what you need:

```
kent$  awk -F':' -v OFS="\t" 'BEGIN{print "Title","Composer", "Price", "PA","PS","TotalP"}{"$1=$1";$(NF+1)=$3*$NF}7' f|column -t -s'    '
Title         Composer  Price  PA  PS  TotalP
Graham        Jack      20.00  10  2   40
Jack          Squall    4.00   5   3   12
Random - One  Jim       5.00   4   1   5
RainyDay      Melissa   50.00  2   1   50

```

* I've shorten the words in header, you can put the full words there
* the last `' '` is `ctrl-v tab`
* the total Profit I just did as `Price * PieceSold`
```
awk -F':' '
BEGIN {
    fmt = "%-15s%-11s%5s   %11s   %10s   %11s\n"
    printf fmt, "Title","Composer","Price","PiecesAvail","PiecesSold","TotalProfit"
}
{ printf fmt, $1,$2,$3,$4"     ",$5"     ",sprintf("%.2f   ",$3*$5) }
' file
Title          Composer   Price   PiecesAvail   PiecesSold   TotalProfit
Graham         Jack       20.00       10            2           40.00    
Jack           Squall      4.00        5            3           12.00    
Random - One   Jim         5.00        4            1            5.00    
RainyDay       Melissa    50.00        2            1           50.00  

```