Re: Editing a text file with sed



On Wed, Aug 29, 2007 at 06:33:54PM +0200, Joe Hart wrote:

On Wednesday 29 August 2007 17:36:38 Kumar Appaiah wrote:
On Wed, Aug 29, 2007 at 03:17:46PM +0200, Joe Hart wrote:
<begin 1.txt>
This is a test
file, what I am
trying to do is get the lines to join.

It isn't a complicated thing,
but I also want to keep the paragraphs
separate.
</end 1.txt>

[snip]

But ideally I'd like to just have a script to do it, but cannot figure
out how to go about it, as sed doesn't seem to be working.

If I run your file through fmt, I get
<output>
This is a test file, what I am trying to do is get the lines to join.

It isn't a complicated thing, but I also want to keep the paragraphs
separate.
</output>

Of course, that may not have been what you were looking for, but I
just thought some might find it useful later.

I appreciate the answer, I didn't even know about the fmt command until now.
It does seem to work in the example, but not on the real file(s) that I am
working with. Something makes me think that these files have some very
strange characters in them, but they don't seem to show up when I cat the
file.

Are they perhaps msdos-formatted? If so does it help to dos2u them
first? (If you don't have any better dos2u, use a file containing this:
perl -pi -e 's/\r\n/\n/g' $1
or similar.

--
richard


--
To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx
with a subject of "unsubscribe". Trouble? Contact listmaster@xxxxxxxxxxxxxxxx



Relevant Pages

  • Re: Editing a text file with sed
    ... separate. ... but I also want to keep the paragraphs ... I didn't even know about the fmt command until now. ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: [SLE] Post Nazis (WAS: Re: [SLE] Software Updates)
    ... separate the bovine effluent from the buckwheat ... *download* all the unreadable messages and I'll go for it. ... "bovine effluent" to continue and eventually constituting the greatest ... I'll probably just unsubscribe after this thread. ...
    (SuSE)
  • Re: Time Outs
    ... while ideally they would be sorted by delay. ... You could have a separate program that received on stdin touples that it ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx ...
    (Debian-User)
  • Re: debian wiki manual how-to
    ... On 12/27/06, Steve Kemp wrote: ... > I have included some how-to's on debian wiki ... be more appropriate if you added the separate pieces as separate ... To UNSUBSCRIBE, email to debian-user-REQUEST@xxxxxxxxxxxxxxxx with a subject of "unsubscribe". ...
    (Debian-User)