| |
| |
| |
|
Comments:
<0> Bonsoir. <1> hi <2> hello plz. <1> is awk the right tool to make this time conversion : <1> 1:05.80 => 0*360 + 1*60 + 05.80 = time in second <1> see what i want ? <2> You want time in seconds.
<3> Any calculator can do that. ;) <1> yea <1> for a string in this form : [HH:]mm:ss.mm <1> maybe sed will be better <2> awk is faster. <2> Than sed. <1> maybe awk is faster, but i am very slow :) <1> to write this parser :) <2> C is faster! <2> or perl is faster than C! depending on who you ask :-) <1> i want a script <1> no idea ? <1> else i will write a python code <3> sed can't calculate. <2> [%] echo '05:01:05.80' | awk -F: '{print $1*360+$2*60+$3}' <2> But you'd have to detect how many :'s are in the "time" before hand so you know if there are hours/mins/secs, or just mins/secs <2> or something. <4> is it possible to write an awk code to fflush output every time it sees a CR (\r) ? <5> ben9: fflush clear the buffers or clear the screen? <4> clears the buffer <4> i.e. print what is in the buffer to screen <5> ben9: explain more what you want to do, maybe there is another way <4> well, i am parsing cdrecord -v output <4> the problem is.. <4> for the live burning status section, it outputs \r not \n, so if i just parse it with the read command, i can only get lines that end with \n or lines that end with \r (using the -d $'\r' option to get \r)
<4> i want to get both so i was hopying i could get awk to flush when it sees a \r and act normal when it sees a \n <4> if you can think of another way to do this, i'm very open to other ideas <4> i just can't find any way to do it well <5> ok <4> it's quite a difficult problem, nobody in #bash could help <5> ben9: try this, dont know if it will work: awk 'BEGIN {ORS="\n\|\r"} {print}' filename <5> ben9: it tests ok on a file with \n but dont have a file with \r to test <4> doesn't work for \r <4> works with RS though <4> awk 'BEGIN {RS="\n\|\r"} {print}' <4> let me try in my script though <4> nope.. i need a fflush somewhere <4> otherwise it buffers <5> ben9: google gawk manual ? <4> i did, i can't figure out how fflush works <5> welcome to the club ;) <4> but this is #awk.. someone should know <5> ben9: i'm a newbie and awk user, not a guru; maybe someone else on this chan knows <4> got it! <5> ben9: guessing RS or ORS is the answer but never coded for that <4> awk 'BEGIN {RS="\n|\r"} {print} {fflush()}' was what i needed <5> ok, i'm rtmf now <5> fflush([file]) <5> The fflush() function. (Disabled with --posix.) <4> what does rtmf mean? <5> rtfm == read the friggin manual ;) <4> well you said "read the manual friggin" =) <5> ben9: ahh, keyboard dyslexia
Return to
#awk or Go to some related
logs:
#ubuntu cari bohsia undefined symbol: __libc_csu_init opengl #css #gimp restart udderweb debian bootsplash 2.6.15.6 app.pid: Permission denied gdm/autostart #php
|
|