Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!aplcen!bink From: bink@aplcen.apl.jhu.edu (Ubben Greg) Newsgroups: comp.editors Subject: Re: double spacing a file w/ SED Summary: sed G Message-ID: <1102@aplcen.apl.jhu.edu> Date: 23 Apr 89 23:26:20 GMT References: <28000@conexch.UUCP> <3365@ddsw1.MCS.COM> Reply-To: bink@aplcen.apl.jhu.edu (Greg Ubben) Distribution: usa Organization: The Johns Hopkins University, Baltimore MD Lines: 26 In article <3365@ddsw1.MCS.COM> nvk@ddsw1.UUCP (Norman Kohn) writes: >In article <28000@conexch.UUCP> chris@conexch.UUCP (Chris Bailey) writes: >>How can I double space a file using SED? > >It would be a whole lot easier to do it with a shell script or with >awk... SED is oriented to lines, yet you're trying to do something that >involves more than a line (at least in the output) Wrong, bucko. The problem was meant for SED! The command to double-space on Unix is simply: sed G To triple-space instead, use: sed "G;G" If this doesn't work on other versions, try the slightly more verbose a (i) command instead to insert a blank line after (before) every line. Example: sed 'a\ ' filename Chris: Using your idea, the command would be sed 's/$/\ /' filename SED can do more than most people think. They turn to the more cumbersome AWK only because they don't understand SED. I challenge you to write a more concise script in AWK or shell, or even one that runs faster. -- Greg Ubben, "A SED fanatic" aplcen.apl.jhu.edu