Search the web
Sign In
New User? Sign Up
todotxt · Todo.txt
? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Hear how Yahoo! Groups has changed the lives of others. Take me there.

Best of Y! Groups

   Check them out and nominate your group.
Having problems with message search? Fill out this form to ensure your group is one of the first to be migrated to the new message search system.

Messages

  Messages Help
Advanced
future tasks (WIP)   Message List  
Reply | Forward Message #2365 of 2423 |
Re: future tasks (WIP)

So....how would I use this in a script? I finally got the python version of
futureTasks working, but when I try to save the attached awk script as a file,
and point to that for my final filter, I get interesting errors like:

F:\Dropbox\My Dropbox\TextFiles>t get testing
/cygdrive/f/dropbox/mydrop~1/textfiles/.todo/future: line 4: $'\r': command not
found
/cygdrive/f/dropbox/mydrop~1/textfiles/.todo/future: line 5: BEGIN: command not
found
/cygdrive/f/dropbox/mydrop~1/textfiles/.todo/future: line 7: syntax error near
unexpected token `('
'cygdrive/f/dropbox/mydrop~1/textfiles/.todo/future: line 7: `today =
strftime("s:%Y-%m-%d")

I'm using this through Cygwin on a WinXP machine. Is there something fancy to
put as the first line in the file, like in a bash script? Should it be saved as
a file at all?

Much appreciated...

--- In todotxt@yahoogroups.com, Ed Blackman <ed@...> wrote:
>
> On Tue, May 12, 2009 at 09:32:25PM +0100, Frederik Dohr wrote:
> >Would you mind sharing that awk command?
>
> Not at all. I've attached it.
>
> Ed
>
>
> # This script relies on the fact that a lexical sort of YYYY-MM-DD datestrings
> # produces the same result as a calendar sort, but avoids the tricky calendar
> # math. It will *not* work for other types of datestring.
>
> BEGIN {
> # save today's date in a t:YYYY-MM-DD datestring
> today = strftime("t:%Y-%m-%d")
> }
> {
> # should this line be printed? default yes
> doPrint = 1
>
> # iterate over each "field" (space-delimited words)
> for(i = 1; i <= NF && doPrint; i++) {
> # does this field match a t:YYYY-MM-DD datestring?
> m = match($i, "t:[0-9]{4}-(0?[0-9]|1[0-2])-([0-2]?[0-9]|3[01])");
>
> # if so, and the datestring is lexically after today's datestring, don't
print
> if(m > 0 && $i > today) {
> doPrint = 0
> }
> }
>
> if(doPrint) {
> print $0
> }
> }
>





Wed Jul 8, 2009 11:30 pm

gtdwannabe
Offline Offline
Send Email Send Email

Forward
Message #2365 of 2423 |
Expand Messages Author Sort by Date

... FWIW, I've worked around this for now: http://github.com/FND/todo.txt-cli/commit/07ce32b94a7f94c496fc67fe12a98b135599b255 I should probably be using...
Frederik Dohr
ace_noone
Offline Send Email
May 28, 2009
1:17 pm

So....how would I use this in a script? I finally got the python version of futureTasks working, but when I try to save the attached awk script as a file, and...
gtdwannabe
Offline Send Email
Jul 8, 2009
11:30 pm

... I haven't been able to get awk to use a #! line correctly, so I just call it like "gawk --re-interval -f $HOME/.todo.actions.d/datefilter.awk" Ed...
Ed Blackman
edgewood73
Offline Send Email
Jul 9, 2009
2:03 am

This is the line you probably want: #!/usr/bin/gawk --re-interval -f...
Mark Harrison
mivok0
Offline Send Email
Jul 9, 2009
4:55 pm

... This is drifting off topic, and I'm OK with the invocation I use now, but that doesn't work: $ head -1 ~/.todo.actions.d/datefilter.awk #!/usr/bin/gawk...
Ed Blackman
edgewood73
Offline Send Email
Jul 9, 2009
8:08 pm

My apologies. I tested with just -f and no --re-interval. It appears #! lines can only take one argument after the program name. Everything afterward is...
Mark Harrison
mivok0
Offline Send Email
Jul 9, 2009
9:07 pm
 First  |  |  Next > Last 
Advanced

Copyright © 2009 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines - Help