LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (http://www.linuxquestions.org/questions/linux-general-1/)
-   -   where to create csv file (http://www.linuxquestions.org/questions/linux-general-1/where-to-create-csv-file-4175443972/)

frhling 01-03-2013 09:55 AM

where to create csv file
 
I wrote a script, I also have a cron job, but the csv files are generated under root BUT I want them to be generated under:
/export/home/aa
I dont know how to define where to generate my csv.

Code:

#!/bin/bash
NAME=evaluation_`date +%Y%m%d`

find /A/B -name "*.log"  -mtime 0 -exec cat "{}" \; >> $NAME.log
grep -e word1 -e word2 $NAME.log | grep -v word3 | awk '{n=split($11,P,"/");print $1 " " $2 ";" $3 ";" $9 ";" $11 ";" P[n]}' > $NAME.csv

echo "done."

Thanks for any help.

TB0ne 01-03-2013 10:09 AM

Quote:

Originally Posted by frhling (Post 4862081)
I wrote a script, I also have a cron job, but the csv files are generated under root BUT I want them to be generated under:
/export/home/aa
I dont know how to define where to generate my csv.

Code:

#!/bin/bash
NAME=evaluation_`date +%Y%m%d`

find /A/B -name "*.log"  -mtime 0 -exec cat "{}" \; >> $NAME.log
grep -e word1 -e word2 $NAME.log | grep -v word3 | awk '{n=split($11,P,"/");print $1 " " $2 ";" $3 ";" $9 ";" $11 ";" P[n]}' > $NAME.csv

echo "done."


Put the path in front of the file name. Instead of "$NAME.csv", it's "/export/home/aa/$NAME.csv".


All times are GMT -5. The time now is 04:05 AM.