| |
| |
| |
|
Page: 1 2
Comments:
<0> isn't it great when the channel topic answers your question? =P <1> Yes. <1> Speaking of that... <1> pr3d4t0r: We could have refered ric24 to http://home.vrweb.de/~juergen.kahrs/gawk/XML/ if he is silly enough to use GNU awk. :) <1> Unless, of course, you did. <0> Ok, question. Suppose I have 2000 text files, each approx 10mb in size. I want to delete the first line of all of them. I don't want it to take all day. What do I do? (If I kill the first line in a text editor and save the file, it takes much less time than if I awk '{blah}' file> newfile ; mv newfile file ... How does the text editor do it so quickly? <1> awk is scanning every line. <1> I have no idea what you are doing with your text editor. <1> if(FNR != 1) {print} <1> Though I doubt that is the best solution. <0> ..it has to do with actually writing all of the file back to disk or not.. The text editor somehow avoids that. I just found out that the sed -i command line argument does, too.. it's 'edit in place'... I dunno how it works, but it's fast, it seems. <2> Hej. <2> newmanbe: Thanks for the heads up. <2> newmanbe: I prefer to avoid gawk's bells and whistles because they're incompatible with POSIX awk. <1> And The One True awk. <2> newmanbe: HeH.
<2> newmanbe: I'll go with POSIX (with apologies to A. W. and K.). <2> newmanbe: As for Sebboh's question... couldn't tail help somehow? <1> Using Plan 9's tail, yes. <1> I don't know about your POSIX tail. :) <0> ?? I can't imagine any use of tail that wouldn't involve re-writing the whole file to disk. But for that matter, I don't know how text editors avoid re-writing a whole file to disk, either.. But surely they must be able to do that: my ram usage doesn't spike when I save a small change to a large file... <1> Which doesn't mean anything. <1> Its very easy to write only part of a file. <0> Ok. That's what I was wondering. <0> Schools? ;) <0> Well of course it's *possible* to modify only the beginning of a file.. you'd just leave the unchanged blocks in place on the disk and point the last block in your changes back to them. But, I don't think that my text editor (mcedit for example) addresses files in that way. <3> I have a bunch of filenames with \n in them. How can I rename them all in a nice automated fashion? filenames are foo\nbar\n[...]baz.txt; i want to just get rid of everything up to and including the last \n <3> rename(1) freaks <4> Guerin: how does rename freak, paste <3> xmb: thanks, i did manage to fix it using a for loop <4> gg <3> rename said something along the lines of `unable to stat filename containing newline' <4> gay <3> yeah, i thought so <3> i wonder if we should blame perl <4> bad coding style maybe <4> problem with quotes aha <4> =p <2> Hej. <5> Evening. <2> goldfish! <6> hi all <6> who wanna answer my question <6> a wanna have a script <6> i need a script which does some work for me <6> it's so easy <6> when a exec iwlist scan <6> it shows me the wireless network list <5> pr3d4t0r: Hey hey. <6> so i wanna choose the ones which has encription key off and the one which has the best signal <6> then it automatically connect that wireless network <5> Stop haxing wireless networks. <6> ??? <5> hehe <5> I'm joking. <6> rkirmizi@laptux ~ $ iwlist scan <6> lo Interface doesn't support scanning. <6> eth0 Interface doesn't support scanning. <5> unlucky. <6> eth1 Scan completed : <6> Cell 01 - Address: 00:12:BF:53:F7:67 <5> yeah <5> oh no... <6> ESSID:"KORDON" <6> Protocol:IEEE 802.11bg <5> You didn't paste :/ <5> BAH! <6> Mode:Master <6> Channel:6 <6> Encryption key:on <6> Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 6 Mb/s; 9 Mb/s <6> 11 Mb/s; 12 Mb/s; 18 Mb/s; 22 Mb/s; 24 Mb/s <6> 36 Mb/s; 48 Mb/s; 54 Mb/s <6> Quality=53/100 Signal level=-69 dBm <6> Extra: Last beacon: 549ms ago
<6> rkirmizi@laptux ~ $ <6> sorry about that <6> do u use pastebin or sth. like that <6> is it allowed to paste in this channel? <2> rkirmizi: Please use the pastebin. <5> Use of a pastebin is encouraged. <2> rkirmizi: What you did is VERY RUDE. <5> But, you know for next time :-) <2> rkirmizi: There is a pastebin in the /topic, or you can use mine http://eugeneciurana.com/pastebin - it has awk syntax highlighting. <6> has anyone have an idea about the problem ? <6> can we do this work with awk and bash implementation <2> rkirmizi: Sure. <6> So <2> rkirmizi: Put that in a pastebin so that I can look at it. <6> who wanna help me? <6> ok <2> Hrm... Turkey. <2> goldfish: Do you want to run with this one? <6> this is iwlist eth1 scan result <6> http://pastebin.com/870489 <5> pr3d4t0r: already working on it. <4> lalla <4> rkirmizi: i have wlan scripts if you want <4> xmb.ath.cx/code/wlan/ <4> see the M script for wlan access <4> err, MM script <4> M is short for something else <6> which one <6> there are a lot <4> MM <6> isn't it so long <4> its just defining of my wardriven aps in bulgaria <4> its small and tight <6> a read that awk scripts are usually just a few rows <2> goldfish: As we said in Mexico: God makes them, they pair themselves together. <4> its a shell script <4> nice predator <4> =) <6> thz <6> i ll try this <6> see u later <6> xmb: thx alot <4> np <5> awww <5> he left. <4> MM big, not mm small <5> :-( <5> *boggle* <5> Hm, I wonder why it thinks 11 is bigger than 100 <5> strtonum to the rescue. Silly me. <5> pr3d4t0r: Can you specify files inside awk scripts? Like, /foo/{stuff;} file ? or can files only be p***ed on the command line <5> Well, that question is to anyone :-) <2> goldfish: Yes. <2> goldfish: And yes. <2> goldfish: Look at getline, close, etc. for opening your own files. You may use redirection to files. <2> goldfish: And, say you have an awk script called script.awk <2> goldfish: script.awk < filename.txt or script.awk filename.txt have the same effect. <5> Ah ok. Thanks. I have lots of awk commands in my xinitrc for displaying stuff on my toolbar, just wondering if it's feasable to put it all into one awk script <5> well, not lots, a few. <7> "goldfish" at 212.2.174.130 pasted "iwlist parser" (36 lines, 663B) at http://sial.org/pbot/22710 <5> if anyone would like to have a look, and tell me if there's any nicer way to break up the output, and reconstuct it. <5> xmb: !!!!!!! <4> what <4> goldfish <4> the parser? <4> cool you tried but probably too much code <4> id do in maybe 5 lines or 10 <4> lets see <4> looks good =) <4> its aight <5> yeah, using split() is rather ugly <4> goldfish: you dont need strtonum <4> awk makes that automagically
Return to
#awk or Go to some related
logs:
eradioportal ubuntu qemu active-sync usb_add #osdev hfstools #css php tmp_name is empty #perl #mysql jedit ubunto usb-storage.ko slow
|
|