Article View: comp.editors
Article #3585Re: double spacing a file w/ SED
From: Ubben Greg
Date: Sun, 23 Apr 1989 23:26
Date: Sun, 23 Apr 1989 23:26
26 lines
1543 bytes
1543 bytes
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
Technical Details
Message-ID:
<1102@aplcen.apl.jhu.edu>Path:
arc1-ca.pugleaf.net!utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!uflorida!haven!aplcen!binkReferences:
<28000@conexch.UUCP> <3365@ddsw1.MCS.COM>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!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