LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices

Reply
 
Search this Thread
Old 01-03-2013, 08:55 AM   #1
frhling
LQ Newbie
 
Registered: Nov 2012
Posts: 4

Rep: Reputation: Disabled
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.
 
Old 01-03-2013, 09:09 AM   #2
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,391

Rep: Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529Reputation: 2529
Quote:
Originally Posted by frhling View Post
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".
 
1 members found this post helpful.
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How to script csv editing? Remove rows from csv file that do not contain certain text ingram87 Linux - Software 9 08-03-2012 12:45 PM
[SOLVED] Need help create a bash script to edit CSV File imkornhulio Programming 13 02-05-2009 10:23 AM
Create 1 csv file from multiple txt files richmur Programming 10 09-03-2008 01:28 PM
Comparing two csv files and write different record in third CSV file irfanb146 Linux - Newbie 3 06-30-2008 09:15 PM
create chart from csv file wolfipa Linux - Software 6 01-31-2008 07:59 PM


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

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration