Hi,
I wants to print the 9th column information with its path name in some txt file. Here is one line which works fine for me:
rfdir /castor/cern.ch/user/s/sudha/forPooja | grep data | awk '{print "rfio:///castor/cern.ch/user/s/sudha/forPooja/"$9}' > dataFilenames.list
rfdir=="ls -ltr"
So with this definition of rfdir, it goes to particular folder, check the content. Grep the column with "data" and print the 9th column in datafilenames.list.
But this line is bit hard coded. I thought of making a flexible script. I could do little.
#!/bin/bash
PATHNAME=$1
#CONSTANT="rfio:"
GREP=$2
OUTPUT=$3
echo "Copying \"$1 | grep $2\" to $3"
rfdir $PATHNAME | grep $2 | awk '{print '$1'$9}' > $3
echo "progressing ... please be patient..."
The error with this try.sh script is following:
[lxplus252] /afs/cern.ch/work/p/pooja/scripts/PhoOptStudy/mc/fall11/GJet > ./try.sh /castor/cern.ch//user/p/pooja/WorkArea/Fall11/GammaJet/GJet30To50/ bkg pooja.log
Copying "/castor/cern.ch//user/p/pooja/WorkArea/Fall11/GammaJet/GJet30To50/ | grep bkg" to pooja.log
awk: {print /castor/cern.ch//user/p/pooja/WorkArea/Fall11/GammaJet/GJet30To50/$9}
awk: ^ syntax error
progressing ... please be patient...
[lxplus252] /afs/cern.ch/work/p/pooja/scripts/PhoOptStudy/mc/fall11/GJet >
I did google, but unable to figure out the solution so far.
Kindly help
Many Thanks,
Pooja