@# Quotes DB     useful, funny, interesting





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


Comments:

<0> karsten, that worked a treat, much obliged, saved me a good hour or so :)
<1> foxnsox: :-)
<1> newmanbe: Behind every special case ...
<1> newmanbe: ... comes an esac.
<2> No, a }.
<3> can i get awk to limit fields to 2, so it only splits at the first FS it encounters?
<4> wallshot: post an example line of text you want to use awk with
<5> wallshot: Use the awk split functions.
<3> somekey="some long value=which may contain=more FS characters"



<3> i'd like to split that into somekey and "some long value=which may contain=more FS characters"
<3> either limiting the field separation to 2 fields, ignoring repeated FS characters would suffice
<3> or if i can somehow print all remaining fields
<3> like ircII when you use "$3-" it means "$3 $4 $5 ..."
<3> since i don't know how many ='s may be in the string, i need just $2 on up all appended together
<4> ok
<3> any way i can reliably print out $2 through the last field would be nice
<3> if it's in the man page, it eluded me though
<3> and afaik, it may not be possible
<3> i'd really like to avoid needing perl for this though
<3> i guess i can get $1, use it as a FS on the original string again to get $2
<3> yes. that works
<3> KEY=`echo $l | awk -F= '{ print $1 }'`
<3> VALUE=`echo $l | awk -F"$KEY=" '{ print $2 }'`
<6> MoiN!
<5> kanaldrache!
<6> Am i right, that there is no way to sort an array regarding elements and get the indices as element? Eh, a[a]=2, a[b]=1 => a[1]=1 , a[2]=b
<6> No internal way i mean
<5> kanaldrache: If you're using gawk, check its sort function.
<5> kanaldrache: It's not standard, but it has one and it may do what you need if you don't care about portability.
<6> Yes, i know, there are asort and asorti but they both do differant things
<5> kanaldrache: I'd use a for statement and a target array.
<6> Sort the elements or sort the indeces, but they do not sort the indices based on the elements
<5> kanaldrache: You already know the number of elements, so traversing the sorted source array and moving the contents to the target may work. Sort of a worst-case hash table :)
<6> Huh?
<7> I have an awk fragment which was given to me (sorry I'm a noob) and it doesn't seem to be working
<7> awk '/^\[/ { gsub(/.*(D| )\] |-[0-9].*/, "") ; print }'
<7> can anyone here actually understand that? (cos I can't!)
<8> what are you trying to do
<7> hey goldfish it's that bit xmb gave me to get the ebuild names from an emerge list
<7> i want to use it for a revdep-rebuild list
<8> and it doesn't work?
<7> no it produces nothing (either with a filename or a pipe)
<7> do you want an example of the revdep lines?
<7> app-cdr/k3b-0.12.17
<9> sup



<7> I think the emerge output had the [ebuild ..] before the name
<7> yo xmb, you ok? bit of awk wizardry req
<9> sure
<9> dude its easy
<9> need to eye it
<7> don't fry my brain!
<7> awk '/^\[/ { gsub(/.*(D| )\] |-[0-9].*/, "") ; print }'
<7> app-cdr/k3b-0.12.17
<9> its the equiv of sed 's/.*[....|...//'
<9> it needs to hot
<9> not to cold/fry
<7> i only get regexps
<9> your brains
<9> that is a regex
<7> yeah but i've had a drink
<9> pff
<7> what's the D
<9> text
<7> k
<7> then space and ?
<7> (after ])
<9> dude #regex or regular-expressions.info =)
<7> pfft
<9> i have noneed to read useless text
<7> np ;)
<9> for real nont
<8> igli: it works here...
<7> goldfish: ? on revdep-rebuild.4 file?
<7> i'll try that atom
<8> no
<8> i just tried on emerge -pv world
<8> obviously that's incorrect
<7> it works great on emerge output
<7> need to take out the stuff for up to ]
<8> give an example before/after example
<7> app-cdr/k3b-0.12.17 -> app-cdr/k3b
<7> it's a bit trickier cos you get -rc1 and all that as well as svn
<7> you've seen the ebuild names, you get dates and so on as versions; i think it's from the first number- let me check
<8> [@] awk '{sub("-[0-9].*","");print}' <<<'app-cdr/k3b-0.12.17'
<8> app-cdr/k3b
<7> nice one
<7> worked a treat on the list :D


Name:

Comments:

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






Return to #awk
or
Go to some related logs:

#math
debian ttyUSB gnokii
3ddeskd: glXIsDirect failed vmware
#fluxbox
Intel 220BG injection
#web
postfix virtual alias Invalid user
limewire + .deb
fluxbox background pixmap aspect
#linux



Home  |  disclaimer  |  contact  |  submit quotes