foreach x (*topRank.txt)
echo `basename $x .txt `
PRE=`basename $x .txt`
cut -f 1 $x | cut -d ' ' -f1 | sed 's/NAME/$PRE/' | sed 's/VC0/VC_0/' | tr "\n" "\t" >> all.log
echo "\n" >> all.log
Overall Goal : For each file in the the current directory which ends with topRank.txt do something
a) cut the first column of the file than further again cut the column by using space a deliminator, now replace NAME with the either just prefix of the file name or may be $x , it doesnt matter as long as the it is I know some how that this line come from this file id.
b) replace few things
c) now put everything on a single line with tr cmd
Everything works ...except following.
a) sed 's/NAME/$PRE/' Or sed 's/NAME/$x/' does not work it replace NAME with $PRE and $x respectively instead of the file name.
b) also when I run the script it tells PRE command not found
Thanks of help.