X-Authentication-Warning: delorie.com: mail set sender to djgpp-bounces using -f From: Rugxulo Newsgroups: comp.os.msdos.djgpp Subject: Re: GNU sed question Date: Sun, 25 Apr 2010 07:24:01 -0700 (PDT) Organization: http://groups.google.com Lines: 65 Message-ID: <5045aa1f-6a1d-4d1a-a1a3-1ae82d412d15@z3g2000yqz.googlegroups.com> References: <4c64a5b1-bf8a-49e1-843e-9a0594856e82 AT c36g2000yqm DOT googlegroups DOT com> <83mxwt17tq DOT fsf AT gnu DOT org> NNTP-Posting-Host: 65.13.115.246 Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Trace: posting.google.com 1272205441 17025 127.0.0.1 (25 Apr 2010 14:24:01 GMT) X-Complaints-To: groups-abuse AT google DOT com NNTP-Posting-Date: Sun, 25 Apr 2010 14:24:01 +0000 (UTC) Complaints-To: groups-abuse AT google DOT com Injection-Info: z3g2000yqz.googlegroups.com; posting-host=65.13.115.246; posting-account=p5rsXQoAAAB8KPnVlgg9E_vlm2dvVhfO User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US) AppleWebKit/532.5 (KHTML, like Gecko) Chrome/4.1.249.1059 Safari/532.5,gzip(gfe) Bytes: 3883 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com Hi, On Apr 24, 6:32=A0pm, "Rod Pemberton" wrote: > "Eli Zaretskii" wrote in message > > > > VI and EDIT are unrelated to Sed. > > So? VI typically is the same binary as EX, which is an improved ED. And both GREP and SED were derived from ED. Besides, ED was indeed used for scripting via redirection, but for files larger than memory, it was necessary (or preferred?) to read a line at a time instead. *BSD uses NVI (heavily-modified from early Elvis) and OS/2 has a port while Linux and Mac OS X use VIM (heavily modified from early SteVIe). Others available are Calvin, XVI, and VILE. (Heck, grab the true original at http://ex-vi.sf.net ) > > Sed is a _stream_ editor, it edits > > files in batch mode, not interactively. > > It is suitable for scripts > > that need to edit text. > > Which is much like, if not the same as, what I mentioned that I did [you > snipped] by generating AWK scripts from VI commands... =A0Yes? VI can use scripts too, it supports the ":source" EX command. VIM even has EXIM. > Except for command line issues, the Sed command the OP posted is the > same as the EX/ED commands in VI. =A0He could do the same for them: gener= ate > AWK scripts from Sed commands, manually or programmatically. =A0Using AWK > could possibly provide an improvement in processing speed. =A0I've seen A= WK > and VI on every non-Windows machine I've ever used, including the > non-Unix/Linux ones where you wouldn't expect to seen them. Typically, I think sh and AWK were the only scripting tools available on *nix. Of course, that's changed now. I don't think AWK (directly) supports in-place editing, which GNU sed 4.x gleaned from Perl anyways. But yes, AWK is nice, and Kernighan still maintains his version (one true AWK), which is what *BSD uses these days. It even compiles with DJGPP (I didn't kick it too hard, don't really know AWK, but it seemed to work). "Updated February 8, 2010" http://www.cs.princeton.edu/~bwk/btl.mirror/ P.S. Rod, why not use VIM or VILE if your 16-bit version runs out of RAM? Oh, and AWK doesn't look too "convoluted", see the GAWK manual (quite large and nice!). Or see Eric Pement's AWK cheatsheet / one- liners: http://invisible-island.net/vile/ ftp://invisible-island.net/vile/vil97dos.zip ftp://invisible-island.net/vile/vile.tar.gz http://www.gnu.org/software/gawk/manual/ http://www.pement.org/awk.htm http://www.pement.org/awk/awk1line.txt http://www.pement.org/awk/awk_sed.txt