public inbox for blinux-list@redhat.com
 help / color / mirror / Atom feed
* Re: word rap?
@  Jim Stevenson
   ` Luke Davis
   ` Jude DaShiell
  0 siblings, 2 replies; 5+ messages in thread
From: Jim Stevenson @  UTC (permalink / raw)
  To: blinux-list-admin, blinux-list

Can ed or ex be set to word rap?

Can col or what else insert <cr> for the last space before column 80?

What if I want a longer line length like 120?

If you must quote me, please put your comments first.
I have already listened to mine.

I read email with speech.
So it is not possible to scroll past the quotes without listening to them again,
to quickly get to the new information.

Thanks.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: word rap?
   word rap? Jim Stevenson
@  ` Luke Davis
     ` Henry Yen
     ` Mike Gorse
   ` Jude DaShiell
  1 sibling, 2 replies; 5+ messages in thread
From: Luke Davis @  UTC (permalink / raw)
  To: blinux-list; +Cc: blinux-list-admin

1.  This is off topic.

2.  No.

3.  Sort of.  I had to reformat a document yesterday, and managed it
by being rather creative with tr, cut, and nano's word wrap.

IIRC, I used cut to remove extraneous whitespace at the start of lines.  I
then used nano to enter the file, press space, backspace, down arrow,
space, backspace, down arrow (rince and repeat), to cause nano to wrap
each line at the screen boundry (this file had _very!_ long lines).
Since I wanted a greater then sign at the begining of each line (I wanted
to use the article in a point by point reply to an email message), I used
tr to exchange all new line characters for a dollar sign (not a common
character in this document), nano to do a global (without prompting)
search-and-replace, thus changing "$" to "$> ", after first turning nano's
word wrap off (escape w).
I then emploied tr again, to reverce my dollar sign conversion, and bingo.

I am reasonably sure, that if I was still proficient in awk, or had ever
managed to get sed to work on anything (the one big unix mystery I have
yet to solve, is to get sed to do the simplest thing based upon the man
page instructions), but I didn't have the time to relearn, or try to
debug, awk, so just used the method above.  A bit tedious, but it worked.

This would have been much easier, if I had taken the time to move the file
to a web server, and write a PHP script to deal with it--the
areg_replace(), and wordwrap(), functions, would have worked wonders on
this file, but there was no php on the local machine, and for some reason,
it didn't occurr to me until just now, that I could have moved the file to
one of the web servers, and done it there.

With awk, or maybe perl, you could do something like this:

* use the standard whitespace field seperators.
* add a word at a time to a string.
* count the characters in each word prior to adding it.
* If the word would take you past 80 characters, output your string,
insert  a new line, and reset the count.
* If not, add the word, and update the count.
* If the next fs is a space, determine if 1 will take the count to 80 or
above.  If so, nl and reset, dumping the space.
* If the next fs is a tab, do the same by adding 8.
* If the fs is a nl, output the string and nl, and reset the count.

I probably missed a condition, and this has no error checking (single
words that are 80 plus characters in length), but you should have enough
of  an idea of the logic, to write it in C, awk, PERL, flex (does anyone
still  use that?), or the language of your choice.

Luke





On Sat, 11 May 2002, Jim Stevenson wrote:

> Can ed or ex be set to word rap?
>
> Can col or what else insert <cr> for the last space before column 80?
>
> What if I want a longer line length like 120?
>
> If you must quote me, please put your comments first.
> I have already listened to mine.
>
> I read email with speech.
> So it is not possible to scroll past the quotes without listening to them again,
> to quickly get to the new information.
>
> Thanks.
>
>
>
> _______________________________________________
> Blinux-list mailing list
> Blinux-list@redhat.com
> https://listman.redhat.com/mailman/listinfo/blinux-list
>

-- 
P.S. If you are interested in a free business opportunity with great
potential, please drop me a line.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: word rap?
   ` Luke Davis
@    ` Henry Yen
     ` Mike Gorse
  1 sibling, 0 replies; 5+ messages in thread
From: Henry Yen @  UTC (permalink / raw)
  To: blinux-list

On Sat, May 11, 2002 at 01:25:05AM -0400, Luke Davis wrote:
> 1.  This is off topic.

yes.

> 2.  No.

'ex', at least on redhat, is just a link to 'vim'.  'vim' definitely
supports word wrap, as well as adjustable columns.

> 3.  Sort of.  I had to reformat a document yesterday, and managed it
> by being rather creative with tr, cut, and nano's word wrap.

you may very well have 'fmt' on your system (try: man fmt).

> On Sat, 11 May 2002, Jim Stevenson wrote:
> > Can ed or ex be set to word rap?
> >
> > Can col or what else insert <cr> for the last space before column 80?
> >
> > What if I want a longer line length like 120?

-- 
Henry Yen                                       Aegis Information Systems, Inc.
Senior Systems Programmer                       Hicksville, New York




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: word rap?
   ` Luke Davis
     ` Henry Yen
@    ` Mike Gorse
  1 sibling, 0 replies; 5+ messages in thread
From: Mike Gorse @  UTC (permalink / raw)
  To: blinux-list

I usually use fmt -s when I need to get rid of long lines; it seems to
work okay.

-- Michael Gorse / AIM:linvortex / http://mgorse.home.dhs.org --





^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: word rap?
   word rap? Jim Stevenson
   ` Luke Davis
@  ` Jude DaShiell
  1 sibling, 0 replies; 5+ messages in thread
From: Jude DaShiell @  UTC (permalink / raw)
  To: blinux-list; +Cc: blinux-list-admin

Jim, suggest you put fmt into the pipeline.  It filters at 72 characters
per line with word wrap and can wrap at other values if you can talk to it
nicely.  info fmt should get you going.  Also look for newfmt either with
man or info.






^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~ UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
 word rap? Jim Stevenson
 ` Luke Davis
   ` Henry Yen
   ` Mike Gorse
 ` Jude DaShiell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).