egghelp.org community Forum Index
[ egghelp.org home | forum home ]
egghelp.org community
Discussion of eggdrop bots, shell accounts and tcl scripts.
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Crontab sort out file

 
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests
View previous topic :: View next topic  
Author Message
Huko
Voice


Joined: 08 Jun 2010
Posts: 18

PostPosted: Fri Aug 27, 2010 3:12 am    Post subject: Crontab sort out file Reply with quote

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
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Aug 27, 2010 3:30 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Huko
Voice


Joined: 08 Jun 2010
Posts: 18

PostPosted: Fri Aug 27, 2010 4:23 am    Post subject: Reply with quote

So I put all the quotes i want it to sort out in test.txt?
Back to top
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Aug 27, 2010 4:33 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Huko
Voice


Joined: 08 Jun 2010
Posts: 18

PostPosted: Fri Aug 27, 2010 4:43 am    Post subject: Reply with quote

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
View user's profile Send private message
tomekk
Master


Joined: 28 Nov 2008
Posts: 255
Location: Oswiecim / Poland

PostPosted: Fri Aug 27, 2010 5:03 am    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Huko
Voice


Joined: 08 Jun 2010
Posts: 18

PostPosted: Fri Aug 27, 2010 5:44 am    Post subject: Reply with quote

Thank you very much tomekkk, you've been really helpful Smile
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    egghelp.org community Forum Index -> Script Requests All times are GMT - 4 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Forum hosting provided by Reverse.net

Powered by phpBB © 2001, 2005 phpBB Group
subGreen style by ktauber