This is the new home of the egghelp.org community forum.
All data has been migrated (including user logins/passwords) to a new phpBB version.


For more information, see this announcement post. Click the X in the top right-corner of this box to dismiss this message.

Crontab sort out file

Requests for complete scripts or modifications/fixes for scripts you didn't write. Response not guaranteed, and no thread bumping!
Post Reply
H
Huko
Voice
Posts: 18
Joined: Tue Jun 08, 2010 2:46 am

Crontab sort out file

Post by Huko »

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:
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:
[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
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

script?

run simple shell command:

Code: Select all

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: Select all

tomekk@tweety:~# cat test.txt | cut -d " " -f5- > quoteupload.txt

Code: Select all

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
H
Huko
Voice
Posts: 18
Joined: Tue Jun 08, 2010 2:46 am

Post by Huko »

So I put all the quotes i want it to sort out in test.txt?
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

this is an example, test.txt is a source file, after '>' is a destination file, you can put there whatever you want
H
Huko
Voice
Posts: 18
Joined: Tue Jun 08, 2010 2:46 am

Post by Huko »

I wrote exactly what you wrote, but I didn't get the same result, theres another part it needs to remove.
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..
User avatar
tomekk
Master
Posts: 255
Joined: Fri Nov 28, 2008 11:35 am
Location: Oswiecim / Poland
Contact:

Post by tomekk »

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,
H
Huko
Voice
Posts: 18
Joined: Tue Jun 08, 2010 2:46 am

Post by Huko »

Thank you very much tomekkk, you've been really helpful :)
Post Reply