Re: Editing a text file with sed
- From: Richard Lyons <richard@xxxxxxxxxxxxx>
- Date: Wed, 29 Aug 2007 22:53:55 +0100
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
- References:
- Editing a text file with sed
- From: Joe Hart
- Re: Editing a text file with sed
- From: Kumar Appaiah
- Re: Editing a text file with sed
- From: Joe Hart
- Editing a text file with sed
- Prev by Date: Re: Strange 224.0.0.251 address being accessed on bootup
- Next by Date: Re: nvidia-glx under Debian 4.0r1
- Previous by thread: Re: Editing a text file with sed
- Next by thread: Re: Editing a text file with sed
- Index(es):
Relevant Pages
|