chris@conexch.UUCP (Chris Bailey) (04/21/89)
How can I double space a file using SED? I have tried SED s/$/$$/g but t that does not work. I am doing this on an IBM PC, so my version of SED may not be perfect. Any ideas?
nvk@ddsw1.MCS.COM (Norman Kohn) (04/23/89)
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) -- Norman Kohn | ...ddsw1!nvk!norman Chicago, Il. | days/ans svc: (312) 650-6840 | eves: (312) 373-0564
ked@garnet.berkeley.edu (Earl H. Kinmonth) (04/23/89)
In article <28000@conexch.UUCP> chris@conexch.UUCP (Chris Bailey) writes: >How can I double space a file using SED? I have tried SED s/$/$$/g but t >that does not work. I am doing this on an IBM PC, so my version of SED >may not be perfect. Any ideas? S=' s/.*/\ &/ ' sed -e "$S" $@ with the MKS Toolkit sed should work. It does under **IX, and I've never had conversion problems from **IX to MKS sed. I can't speak to other PeeCee sed(s).
bink@aplcen.apl.jhu.edu (Ubben Greg) (04/24/89)
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
ked@garnet.berkeley.edu (Earl H. Kinmonth) (04/24/89)
In article <1102@aplcen.apl.jhu.edu> bink@aplcen.apl.jhu.edu (Greg Ubben) writes: >SED can do more than most people think. They turn to the more cumbersome Unfortunately the documentation manages to hide most of the capabilities or forces you to discover the full range of capabilities by very time consuming experiments. Then, when you've figured out how to make it work on a subset of your problem, you discover it has some undocumented internal limit that prevents your script from working with real world data.
tarsa@elijah.mv.com (Greg Tarsa) (04/24/89)
You folks are thinking too hard. The following SED command line will sed G file.name The G appends the (empty) hold area to the pattern space with a newline between them. Yours for happy stream editing, Greg Tarsa Tarsa Software Consulting -------------------------------- 33 Seabee Street Bedford, NH 03102 tarsa@elijah.mv.com (603)668-9226 {decuac,decvax}!elijah!tarsa
morrell@hpsal2.HP.COM (Michael Morrell) (04/25/89)
/ hpsal2:comp.editors / chris@conexch.UUCP (Chris Bailey) / 5:46 pm Apr 20, 1989 / How can I double space a file using SED? ---------- Have you tried "sed G". It's one of my favorites. Michael