Path: utzoo!attcan!uunet!bu.edu!rpi!zaphod.mps.ohio-state.edu!samsung!cs.utexas.edu!sun-barr!olivea!orc!inews!cmdnfs!bhoughto From: bhoughto@cmdnfs.intel.com (Blair P. Houghton) Newsgroups: comp.unix.questions Subject: Re: edit first line of long file Message-ID: <568@inews.intel.com> Date: 23 Oct 90 00:41:32 GMT References: <27338@shamash.cdc.com> Sender: news@inews.intel.com Organization: Intel Corp, Chandler, AZ Lines: 20 In article <27338@shamash.cdc.com> ddh@dash@udev.cdc.com (Dan Horsfall) writes: >Plan A: pass the whole file thru sed, qualifing the search string >as "1s/.../.../"; sed will look at each line of the file. sed is the way. it's not that much slower than cat (0.9 seconds cpu vs. 0.0, but the perceived time was about a second either way and computed to 0:00). Anything else would involve multiple exec's and pipes and several context switches for each character of data, and then you get process and I/O collisions. I'll predict nothing (except perhaps awk or certainly perl or C) would be faster than the sed line, and by posting to the net you've just cost yourself and the world more time, bytes, and money than any of these choices could possibly be worth. --Blair "There are perspectives to consider when the software warns you it's about to spend a lot of net.dough."