| View previous topic :: View next topic |
| Author |
Message |
Huko Voice
Joined: 08 Jun 2010 Posts: 18
|
Posted: Fri Aug 27, 2010 3:12 am Post subject: Crontab sort out file |
|
|
I`m using public_quotes.tcl, when you add a quote it adds it to "/home/user/eggdrop/quotes.db" in the form of:
#Quotenumber Date Time #Channel Who-Added-the-quote Quote
Example:
1 10/19/2009 16:41:19 #shishkebab [17:21] <+saethr> usa owns kuwait | [17:21] <+Ropaz^> lol where do you know that? | [17:21] <+Ropaz^> kuwait is a state on iraq | [17:22] <+Ropaz^> its like Lyon in france
I could really need a script that once a day, scans that file and makes a new file in that folder called "quoteupload.txt" - the script should remove the all the necessary details except for the quote itself.
So if the quote was:
| Quote: | | 1 10/19/2009 16:41:19 #shishkebab [17:21] <+saethr> usa owns kuwait | [17:21] <+Ropaz^> lol where do you know that? | [17:21] <+Ropaz^> kuwait is a state on iraq | [17:22] <+Ropaz^> its like Lyon in france |
The script will make a new file with this output:
| Quote: | | [17:21] <+saethr> usa owns kuwait | [17:21] <+Ropaz^> lol where do you know that? | [17:21] <+Ropaz^> kuwait is a state on iraq | [17:22] <+Ropaz^> its like Lyon in france |
|
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Fri Aug 27, 2010 3:30 am Post subject: |
|
|
script?
run simple shell command:
| Code: | tomekk@tweety:~# cat test.txt
1 10/19/2009 16:41:19 #shishkebab [17:21] <+saethr> usa owns kuwait | [17:21] <+Ropaz^> lol where do you know that? | [17:21] <+Ropaz^> kuwait is a state on iraq | [17:22] <+Ropaz^> its like Lyon in france
2 10/19/2009 16:41:19 #shishkebab [17:21] <+saethr> usa owns kuwait | [17:21] <+Ropaz^> lol where do you know that? | [17:21] <+Ropaz^> kuwait is a state on iraq | [17:22] <+Ropaz^> its like Lyon in france
2341 10/19/2009 16:41:19 #shishkebab [17:21] <+saethr> usa owns kuwait | [17:21] <+Ropaz^> lol where do you know that? | [17:21] <+Ropaz^> kuwait is a state on iraq | [17:22] <+Ropaz^> its like Lyon in france
|
| Code: | | tomekk@tweety:~# cat test.txt | cut -d " " -f5- > quoteupload.txt |
| Code: | tomekk@tweety:~# cat quoteupload.txt
[17:21] <+saethr> usa owns kuwait | [17:21] <+Ropaz^> lol where do you know that? | [17:21] <+Ropaz^> kuwait is a state on iraq | [17:22] <+Ropaz^> its like Lyon in france
[17:21] <+saethr> usa owns kuwait | [17:21] <+Ropaz^> lol where do you know that? | [17:21] <+Ropaz^> kuwait is a state on iraq | [17:22] <+Ropaz^> its like Lyon in france
[17:21] <+saethr> usa owns kuwait | [17:21] <+Ropaz^> lol where do you know that? | [17:21] <+Ropaz^> kuwait is a state on iraq | [17:22] <+Ropaz^> its like Lyon in france |
crontab -e and go on,
cheers |
|
| Back to top |
|
 |
Huko Voice
Joined: 08 Jun 2010 Posts: 18
|
Posted: Fri Aug 27, 2010 4:23 am Post subject: |
|
|
| So I put all the quotes i want it to sort out in test.txt? |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Fri Aug 27, 2010 4:33 am Post subject: |
|
|
| this is an example, test.txt is a source file, after '>' is a destination file, you can put there whatever you want |
|
| Back to top |
|
 |
Huko Voice
Joined: 08 Jun 2010 Posts: 18
|
Posted: Fri Aug 27, 2010 4:43 am Post subject: |
|
|
I wrote exactly what you wrote, but I didn't get the same result, theres another part it needs to remove.
| Quote: | | 1 10/19/2009 16:41:19 #shishkebab Tony [17:21] <+saethr> usa owns kuwait | [17:21] <+Ropaz^> lol where do you know that? | [17:21] <+Ropaz^> kuwait is a state on iraq | [17:22] <+Ropaz^> its like Lyon in france |
Tony <-= the person who added the quote, I need that removed too.. |
|
| Back to top |
|
 |
tomekk Master

Joined: 28 Nov 2008 Posts: 255 Location: Oswiecim / Poland
|
Posted: Fri Aug 27, 2010 5:03 am Post subject: |
|
|
yes, the result will not be the same, cause the number of arguments is bigger than before, you didnt't write it before...
change -f5- to -f6- but in this case this will not work for previous example, |
|
| Back to top |
|
 |
Huko Voice
Joined: 08 Jun 2010 Posts: 18
|
Posted: Fri Aug 27, 2010 5:44 am Post subject: |
|
|
Thank you very much tomekkk, you've been really helpful  |
|
| Back to top |
|
 |
|