hi,
I wrote a simple bash script:
putHeader(){
for fl in `find -name "$1"`; do
echo $fl;
tmpNm=$(basename $fl).tmp;
awk -v hd=$2 'BEGIN{print "hd"}' $fl > $tmpNm
#sed -e '1i \ $2' $fl > $tmpNm
rm $fl
mv $tmpNm $fl
done
}
I would like to put header into specified files like:
putHeader "*.dat" "energy errors"
Nither, awk not sed does not work. Could someone tell me why?
I wrote a simple bash script:
putHeader(){
for fl in `find -name "$1"`; do
echo $fl;
tmpNm=$(basename $fl).tmp;
awk -v hd=$2 'BEGIN{print "hd"}' $fl > $tmpNm
#sed -e '1i \ $2' $fl > $tmpNm
rm $fl
mv $tmpNm $fl
done
}
I would like to put header into specified files like:
putHeader "*.dat" "energy errors"
Nither, awk not sed does not work. Could someone tell me why?