ule praxis
                      random notes for day to day operation

For all the gesticulation and pontificating previously there is little reason
to be using a line editor on a PC.

Delete all but the last 10 logs in a directory:

     >ls -1 *.log > x    - create the list
     >ule x
     >e                  - goto end
     >-10                - back up 10 lines
     >d 9999             - delete the rest of file
     >0                  - go to top of file
     >ca //rm /          - squeeze rm in front of each line
     >. ./x              - execute script
     >rm x               - clean up!

--locate, number, and zoom cycle--

For programming or such this is a very common cycle. Use locate to find all 
occurances of a string, say fgets, enter the line # of the appropriate line, 
and print zoom (pz). This shows 10 lines before and after the appropriate
line. From here serious work may commence.

--imbedded tabs--

This can be a problem for any line editor since the display shows blanks when
the file may contain a <TAB> character. ule makes no attempt to deal with
<TAB> characters. If you insist you may even do inserts, replaces, and even
locates and changes entering <TAB> characters. The simplest solution however 
is to expand tabs using the following: (or something like it)
usage: >exptabs [tabsetting(=8)] <infile >outfile

main (int argc, char **argv) {
   int c,p,ts;
   if (argc==2) {ts=atoi(argv[1]);}
   while (c != EOF) {
      switch(c) {
         case EOF : break;
         case '\t' :
            do {
               putchar(' ');
               } while( (p % ts) != 1);
         case '\n' : putchar(c); p=1;   break;
         default   : putchar(c); p=p+1; break;
--using cut and paste--

Obviously there is no cut and paste with a line editor. Well kind of. The idea
is put ule in INPUT mode, make the cut, make the paste, and as long as the cut
has no blank lines (to keep ule from going back to EDIT mode) the operation
should be sussesful. However the screen may look funny. Consider the following
example: note <CR> means enter carriage return

/home/oracle >cat hiworld.c     (WE WILL CUT THE NEXT 4 LINES)----------------
   printf("hello world!\n");
/home/oracle >ule hw.c

>>>> Holg's ULE (Unix Line Editor) V1.2x experimental!? (12/05/97)
>>>>        64000 Lines Maximum!

>>>>>>>>NEW FILE

>>>>>>>>    FILE :hw.c
>>>>>>>> # Lines :     0

   0E><CR>                      (ule IS PUT INTO INPUT MODE)-----------------
   printf("hello world!\n");     1I>     2I>
     3I>     4I><CR>            (DONE! BUT THE SCREEN LOOKS FUNNY, GO EDIT MODE)
     3.>   printf("hello world!\n");
   0E>                         (ITS OK! YOUR RESULTS MAY VARY)----------------