![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to cut data block from .txt file in shell scripting | pank29 | UNIX for Dummies Questions & Answers | 6 | 04-25-2009 03:05 PM |
| data formatting in Unix shell Scripting | regnumber | Shell Programming and Scripting | 1 | 10-04-2008 06:45 PM |
| converting a tabular format data to comma seperated data in KSH | Hemamalini | UNIX for Dummies Questions & Answers | 2 | 06-16-2008 05:37 AM |
| how to verify that copied data to remote system is identical with local data. | ynilesh | Shell Programming and Scripting | 3 | 01-31-2008 08:55 AM |
| Howto capture data from rs232port andpull data into oracle database-9i automatically | boss | UNIX for Dummies Questions & Answers | 1 | 09-23-2007 03:35 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi there, Im having a problem with my script... dont now how to finish. I have a more than 50 files in folder where is myscript. I manage to make this script work but i have a problem with files i want to send. We talk about .log files. My script look like this: Code:
#!/bin/sh. more subscriber.log | grep Purchase subscriber.log > dacha ftp -v -n "10.15.20.245" <<cmd user "fun" "fun" send dacha quit cmd but i have a problem because i dond need subscriber.log i need subscriber.log from day before etc. subscriber.log.2009-08-15 and it should be generated for every day but a date should be from yesterday. my log looks like this: Code:
subscriber.log.2009-08-13 subscriber.log.2009-08-14 subscriber.log.2009-08-15 my script should also do the grep and the FTP but i manage to do this, i just dont know how to force this script to take log file form yesterday. please help, and thanks sincerly yours Voltaza Last edited by Franklin52; 08-21-2009 at 08:28 AM.. Reason: adding code tags |
|
||||
|
Code:
find <directory> -mtime +1 -name <pattern of the file name> -exec ls -el {} \;
This command should give you the file created a day earlier. You cut the file name field and use in your script. S Last edited by Franklin52; 08-21-2009 at 08:28 AM.. Reason: adding code tags |
|
||||
|
Thanks mate,
but i dont know where to put this line? before grep ? Is this the first line in my script? I also have to automate this script so it can work every day... i need that this script use log file from yestrday from all logs in this dir. cool zaxxon. tnks Last edited by voltaza; 08-21-2009 at 08:31 AM.. |
|
||||
|
Code:
#!/bin/sh.
find <directory> -mtime +1 -name subscriber* -exec ls -el {} \; >> temp.file
#cut the last field to get the file name and assign it to a variable filname
more $filname | grep Purchase subscriber.log > dacha
ftp -v -n "10.15.20.245" <<cmd
user "fun" "fun"
send dacha
quit
cmd
|
|
||||
|
this code give me log file from today 21 and i need a file from yestrday subscriber.log.2009-08-20 my last field is subscriber.log and no date... Code:
#!/bin/sh.
find <directory> -mtime +1 -name subscriber* -exec ls -el {} \; >> temp.file
#cut the last field to get the file name and assign it to a variable filname
more $filname | grep Purchase subscriber.log > dacha
ftp -v -n "10.15.20.245" <<cmd
user "fun" "fun"
send dacha
quit
cmd
|
|
||||
|
Quote:
---------- Post updated at 01:44 PM ---------- Previous update was at 01:34 PM ---------- ? help ![]() ---------- Post updated at 01:56 PM ---------- Previous update was at 01:44 PM ---------- I dont need last file... i need file before that.... Last edited by voltaza; 08-21-2009 at 08:40 AM.. |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|