From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by listman.redhat.com (Postfix) with ESMTP id BF4183EA05 for ; Sat, 11 May 2002 13:25:06 -0400 (EDT) Received: (from mail@localhost) by int-mx1.corp.redhat.com (8.11.6/8.11.6) id g4BHP7A31344 for blinux-list@listman.redhat.com; Sat, 11 May 2002 13:25:07 -0400 Received: from mx1.redhat.com (mx1.redhat.com [172.16.48.31]) by int-mx1.corp.redhat.com (8.11.6/8.11.6) with SMTP id g4BHP6l31340; Sat, 11 May 2002 13:25:06 -0400 Received: from server1.shellworld.net (root@server1.shellworld.net [64.39.15.178]) by mx1.redhat.com (8.11.6/8.11.6) with SMTP id g4BHJLM16373; Sat, 11 May 2002 13:19:21 -0400 Received: from localhost (ldavis@localhost) by server1.shellworld.net (8.11.1/8.11.1) with ESMTP id g4BHP5s88066; Sat, 11 May 2002 12:25:06 -0500 (CDT) (envelope-from ldavis@shellworld.net) Date: Sat, 11 May 2002 13:25:05 -0400 (EDT) From: Luke Davis To: blinux-list@redhat.com Cc: blinux-list-admin@redhat.com Subject: Re: word rap? In-Reply-To: <200205111518.g4BFIGiZ029170@eos.arc.nasa.gov> Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Loop: blinux-list@redhat.com Sender: blinux-list-admin@redhat.com Errors-To: blinux-list-admin@redhat.com X-BeenThere: blinux-list@redhat.com X-Mailman-Version: 2.0.1 Precedence: bulk Reply-To: blinux-list@redhat.com List-Help: List-Post: List-Subscribe: , List-Id: Linux for blind general discussion List-Unsubscribe: , List-Archive: 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 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.