problems with a script that outputs data to a file

First of all, im a total newbie to the point that i do not know what are the terms to search for my problem. I did however spend the rest of the day today trying to figure out what is wrong with my bash script. ive always thought that the best way to learn is to tackle a problem heads on. but at the end of this, the only thing i seemed to learn is i suck at this...

basically.. all i want is to create a shell script to grep data from a file and get an output sorted out only with the data i need.

1) grep "consistent expression." $logfile | cut -d"" -f11 > transaction1

2) for file in `cat transaction1` ;do grep ${file} $logfile | grep "/consistent/expression/2" | cut -d"=" -f6 | cut -d"-" -f1,3 | head -1 ; done > transaction2

3) for file in `cat transaction2`; do grep -l "NUMBER ID" ${file}/files/* | cut -d"=" -f2,3 | head -1 ; done > transaction3

4) sed 's/[1]//;s/[ \t]$//' transaction3 (to remove spaces)

5) merge transaction1 with transaction3 with echo to indicate what the data means

for e.g

becomes

any guidance is very much appreciated..

thanks...


  1. \t ↩︎

Maybe there's a better way to achieve that, post your input file and the desired output.

Regards