From demas@sunspot.tiac.net Mon Aug 17 02:02:53 1998 Path: fu-berlin.de!news-peer.gip.net!news.gsl.net!gip.net!cpk-news-hub1.bbnplanet.com!cam-news-hub1.bbnplanet.com!news.bbnplanet.com!news-feed1.tiac.net!posterchild2!news@tiac.net From: demas@sunspot.tiac.net (Charles Demas) Newsgroups: alt.comp.editors.batch,comp.unix.shell,comp.editors Subject: Re: sed question Date: 16 Aug 1998 19:08:11 GMT Organization: The Internet Access Company, Inc. Lines: 73 Distribution: inet Message-ID: <6r7amr$q3@news-central.tiac.net> References: NNTP-Posting-Host: sunspot.tiac.net To: Al Aab Xref: fu-berlin.de alt.comp.editors.batch:3066 comp.unix.shell:66096 comp.editors:32861 In article , Al Aab wrote: > > sed "p;s/^\(.\{72\}\).\{8\}/\1 /" Actually, that also breaks (no substitution is made because the Regular expression doesn't match the line) when there are less than 80 characters per line. i.e./e.g. no substitution is made on 79 character line. This is perhaps better: sed 's/^\(.\{72\}\).\{0,8\}/\1 /' filename Chuck Demas Needham, Mass. > >Charles Demas (demas@sunspot.tiac.net) wrote: >: In article <6quv6l$u7s$1@nnrp1.dejanews.com>, >: wrote: >: >Hi, >: > >: >I'd like to edit a file to change contents from column 73 to 80 to >; >spaces. Is this possible done by sed? BTW, I try not use ^....(72 dots). > > >: Well, how about: > >: sed 's/......../ /10' infile > >: which doesn't change anything for a 79 column line, or any lines without >: 80 columns, but this would: > >: sed 's/./ /73;s/./ /74;s/./ /75;s/./ /76;s/./ /77;s/./ /78;s/./ /79;s/./ /80' > >: this is just > >: sed 's/./ /73' infile > >: repeated for the other columns one wished changed. > >: So, this only took me 8 dots in either approach. :-) > > >: Chuck Demas >: Needham, Mass. > > >: -- >: Eat Healthy | _ _ | Nothing would be done at all, >: Stay Fit | @ @ | If a man waited to do it so well, >: Die Anyway | v | That no one could find fault with it. >: demas@tiac.net | \___/ | http://www.tiac.net/users/demas >-- >=-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- >al aab, seders moderator sed u soon > it is not zat we do not see the s o l u t i o n >-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ >-- >=-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+- >al aab, seders moderator sed u soon > it is not zat we do not see the s o l u t i o n >-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-+ -- Eat Healthy | _ _ | Nothing would be done at all, Stay Fit | @ @ | If a man waited to do it so well, Die Anyway | v | That no one could find fault with it. demas@tiac.net | \___/ | http://www.tiac.net/users/demas