@# Quotes DB     useful, funny, interesting





Google
 
Web www.quotesdb.info
Undernet  |  EFnet  |  Quakenet  |  Freenode  |  Dalnet  |  Ircnet  |  Galaxynet


Comments:

<0> awk: (FILENAME=- FNR=319) warning: gensub: third argument of 0 treated as 1
<0> can anybody enlight me a bit, please?
<0> Hm.
<1> holzplatten: you want filename to be stdin using - ?
<0> wait, I think I found the answer :)
<0> ls | awk '/smd$/ {print(gensub("smd", "zip", g))}' <-- this was the line
<0> and g must be "g"
<0> gnubien: thank you anyway :)
<1> easy fix, have fun ;)
<2> question regards xmb's soulution: awk -v var=var '$0 ~ "^" var'
<2> is the "^" var part treated as a reular expression ie the "^" means at start of line??
<1> ronins: echo "var 134" |awk -v var=var '$0 ~ "^" var' # var 134 echo "hi var 134" |awk -v var=var '$0 ~ "^" var' # no output
<3> holzplatten: are you on linux ?



<3> actually
<3> what are you trying to do?
<2> sorry for my confusion: original problem was i wanted to match /^var/ where 'var' is a variable
<2> that is if variable var contained string "abc" then i wanted /^var/ to match "abc" at beginning of $0
<3> don't use //
<3> use $0 ~ var
<0> goldfish: I am on GNU/Linux
<0> just was trying to compress some files
<3> k
<2> right; xmb's solution was to use $0 ~ "^" var where 'var' is the name of my variable that contains the string "abc"
<3> i see
<0> goldfish: thanks for your appointment
<2> my question is does the ~ ***ume that the right hand sign is a regular expression ie the "^" is interpreted as meaning at beginning of $0 ?
<2> 'right hand sign' -> 'right hand side'
<0> goldfish: do you mean to use ~ when calling awk from the shell?
<3> nope
<3> mine was for ronins
<0> oh, sorry
<3> ronins: probably
<3> ronins: no idea why he put it there
<2> so are you saying: if a.awk file is: $0 ~ "^abc" {print}
<2> that only lines that will printed are those that actually have the symbol ^ at start of line
<2> and not those where "abc" string is at start of line ??
<4> ronins: It's simple enough to test that.
<4> ronins: My naive understanding is that the regex would be start-of-line anchored.
<2> your right; just much easier to ask here or open the book
<4> http://channels.debian.net/paste/5027
<3> no
<3> ronins: ^ == start of line
<4> goldfish: See paste
<4> goldfish: and parse my comment properly.
<4> goldfish: ... ***uming "no" was aimed at me.
<4> So ... are scanf(3) formats readily usable / translatable in awk?
<4> http://www.die.net/doc/linux/man/man5/proc.5.html
<5>/stat parser.
<2> thanks karsten for the pastebin; the "^" at right hand of ~ is taken as regular expression metacharacter and not as literal ^
<4> ronins: Building really simple test cases like that is a very good development techninque.
<4> ronins: Write an awk one-liner. Use a here doc to feed in values. See what pops out.
<2> of course here from Start/Run: %awk% "$0 ~ \"^abc\""
<4> Note that {print} is the default action on all matched lines and is redundant. So: "awk '/pattern/}'" == "awk '/pattern/ {print}' ~= grep 'pattern'
<2> at least here we use "The One True AWK" :-)
<2> Brian W. Kernighan -- the "k" of awk http://www.cs.bell-labs.com/who/bwk/index.html
<3> indeed.
<3> what a man.



<3> UNIX -- C -- AWK
<3> amongst other things.
<3> Truely amazing.
<2> its all Our Language; AWK rules !!
<4> ronins: No. Our language is R.
<4> ;-)
<3> Hmm.
<4> It's "R" language....
<2> anyone into benchmarking? ie why would rand(i) be 3 times faster than rand() ??
<2> eg: timethis %awk% \"BEGIN {for(i=1;i<=1000000;i++)j1=rand(i);exit;}\"
<2> is 3 (three) times faster than: timethis %awk% \"BEGIN {for(i=1;i<=1000000;i++)j1=rand();exit;}\"
<2> subtract the base time for loop from above: timethis %awk% \"BEGIN {for(i=1;i<=1000000;i++);exit;}\"
<6> morning
<2> k; did u read the posts above?
<6> newp
<6> now read it, i dont like rand()
<6> ronins: need any question or script?
<7> :P
<2> later thanks; its 1:56 am here and i have to crash
<8> hi all
<8> i've taken a look at those scripts, can't seem to adapt for what i need, i've got an exim log which i need to parse properly
<8> a simple grep will output the rejected emails
<8> but i need to format them in the From: moo@moo.com Recipient: you@you.com Reason for rejection: blah blah blah
<8> any1 know what the correct procedure in awk would be?
<9> "wzd" at 196.25.255.250 pasted "Need to format this in a more user readable format..." (10 lines, 542B) at http://sial.org/pbot/22159
<8> http://sial.org/pbot/22159
<8> heh.
<8> faster than me ;)
<8> bots ftw
<8> anyone got any bright ideas?
<3> burntnode: awk '{gsub("F=<|>","",$5); gsub("[<>:]","",$8);printf "Date: %s\nFrom: %s\nRecipient: %s\nRejected: ", $1, $5, $8; for(i=9;i<NF;i++){printf $i" "}; printf "\n"}'
<3> Not a very nice solution, mind you.
<10> hmm interesting
<10> sed isnt that much better
<10> sed 's/^\([^ ]*\).*F=<\([^>]*\)> rejected RCPT <\([^>]*\)>/Date: \1\nFrom: \2\nRecipient: \3\nRejected/'
<3> it's better.
<10> yeah
<10> still getting some errors though
<10> temporarily rejected RCPT
<10> occurs at times
<10> that also needs to be parsed
<10> also can't seem to put a new line after Rejected
<10> without the script hanging/dying
<3> well
<3> you don't have to hardcore rejected RCPT
<3> eh.
<3> hardcode.
<10> what else should i put so that it matches both rejected RCPT and temporarily rejected RCTP masks
<10> i have to use literal new lines
<10> for sed
<10> dont have sed gnu
<3> .*RCPT
<3> or something.
<3> depends i suppose
<10> you know how i would put a linebreak or newline before Date: or after Rejecte ?
<10> literal new line doesnt want to work
<9> "burntnode" at 198.54.202.250 pasted "How about this then?" (11 lines, 307B) at http://sial.org/pbot/22171


Name:

Comments:

Please enter the result of the sum 63 + 46 (to avoid spam):






Return to #awk
or
Go to some related logs:

#math
ubuntu siocaddrt: invalid argument
#lisp
mysqldump: Got error: 1033
emerge gororaa
mibssam
startfluxbox not working
#oe
magicqoutes
#ubuntu



Home  |  disclaimer  |  contact  |  submit quotes