ule in 5 minutes
                (or how to become MASTER OF YOUR DOMAIN)

ule is a LINE editor, that is an editor that operates on files one line at
a time and navigates using line numbers. Most ule commands  begin  with  a
single letter, upper or  lower  case.  At any time  ule  displays the line
number and the contents of the line upon which commands will operate.

COMMANDS BY FUNCTION: commands in red are covered in this 5 minute guide.
FILE: PRINT: SEARCH: o-old p-print l-locate s-save f-find w-write LINE: a-add MODIFY: q-quit i-insert d-delete c-change NAVIGATE: r-replace h-hack b-break x-space n-next j-join e-end MISC: #-line BLOCK: +-jump t-tab --jump m-move v-values k-kopy !-scale ?-help
FILE COMMANDS:
# To edit a file with ule: unix >ule ule.c >>>> Holg's ule (Unix Line Editor) V2.0 (04/02/99) >>>> 111111 Lines Maximum! >>>>>>>> FILE :ule.c >>>>>>>> # Lines : 1369 0E>
# To load (o - old) a new file: 0E>o hello.c >>>>>>>> FILE :hello.c >>>>>>>> # Lines : 8 0E>
# To quit (q - quit (exit)) a file: 0E>q unix >
# To save (s - save) a file: 0E>s >>> FILE <ule.c> 1369 Lines Written 0E>
# To save and quit (sq - savequit) a file: 0E>sq >>> FILE <ule.c> 1369 Lines Written unix >
# To write (w - write) a file to a different file name: 0E>w ule.old >>> FILE <ule.old> 1369 Lines Written 0E>
NAVIGATE COMMANDS:
To go to the next (n - next) line: 66.> if (command=='a') acommand(); 66E>n 67.> else if (command=='b') bcommand(); 67E>
To go to the end (e - end): 67.> else if (command=='b') bcommand(); 67E>e 1369.> } 1369E>
To go to a given line # enter the line #: 1369.> } 1369E>66 66.> if (command=='a') acommand(); 66E>90 90.> else if (command=='y') ycommand(); 90E>162 162.>int acommand() 162E>
PRINT COMMANDS:
# To print (p - print) a line: 66E>p 66.> if (command=='a') acommand(); 66E>
# To print (p #) a # of lines: 66.> if (command=='a') acommand(); 66E>p 10 66.> if (command=='a') acommand(); 67.> else if (command=='b') bcommand(); 68.> else if (command=='c') ccommand(); 69.> else if (command=='d') dcommand(); 70.> else if (command=='e') ecommand(); 71.> else if (command=='f') fcommand(); 72.> else if (command=='g') gcommand(); 73.> else if (command=='h') hcommand(); 74.> else if (command=='i') icommand(); 75.> else if (command=='j') jcommand(); 75E>
# To print (p #1 #2) a range of lines: 75.> else if (command=='j') jcommand(); 75E>p 70 80 70.> else if (command=='e') ecommand(); 71.> else if (command=='f') fcommand(); 72.> else if (command=='g') gcommand(); 73.> else if (command=='h') hcommand(); 74.> else if (command=='i') icommand(); 75.> else if (command=='j') jcommand(); 76.> else if (command=='k') kcommand(); 77.> else if (command=='l') lcommand(); 78.> else if (command=='m') mcommand(); 79.> else if (command=='n') ncommand(); 80.> else if (command=='o') ocommand(); 80E>
LINE COMMANDS:
To insert a line: 91.> else if (command=='z') zcommand(); 91E>i else if (command=='A') Acommand(); 92E>i else if (command=='B') Ccommand(); 93E>
To replace a line: 93.> else if (command=='B') Ccommand(); 93E>r else if (command=='B') Bcommand(); 93.> else if (command=='B') Bcommand(); 93E>
To delete a line: 92.> else if (command=='A') Acommand(); 93.> else if (command=='B') Bcommand(); 93E>d 92.> else if (command=='A') Acommand(); 92E>
SEARCH COMMANDS:
To locate (l string) a line containing a string: 0.> 0E>l fgets 127.> while (fgets(u,MAXLENGTH,infile) != NULL) 127E>l open 166.> FILE *infile,*fopen(); 166E>l NULL 169.> if ((infile=fopen(aname,"r"))==NULL) 169E>l 174.> while (fgets(u,MAXLENGTH,infile) != NULL) 174E> (Note just l repeats last locate.)
CHANGE COMMANDS:
To change a string in a line: c /string1/string2/[g] 100.> } 100E>i abcdefghijklmnopqrstuvwxyz 101E>p 101.>abcdefghijklmnopqrstuvwxyz 101E>c /e/a/ 101.>abcdafghijklmnopqrstuvwxyz 101E>c /mno/abc/ 101.>abcdafghijklabcpqrstuvwxyz 101E>c /xyz/abc/ 101.>abcdafghijklabcpqrstuvwabc 101E>c /abc/123/ 101.>123dafghijklabcpqrstuvwabc 101E>c 101.>123dafghijkl123pqrstuvwabc 101E>c 101.>123dafghijkl123pqrstuvw123 101E>c No Changes 101E>c /123/789/g 101.>789dafghijkl789pqrstuvw789 101E> (Note just c repeats last change.) (Note g means global change.)
EXAMPLE SESSIONS:
Now create a file hiworld.c : unix >ule hiworld.c >>>> Holg's ule (Unix Line Editor) V2.0 (04/02/99) >>>> 111111 Lines Maximum! >>>>>>>>NEW FILE >>>>>>>> FILE :hiworld.c >>>>>>>> # Lines : 0 0E>i main() 1E>i { 2E>i printf("hi world!\n"); 3E>i } 4E>sq >>> FILE <hiworld.c> 4 Lines Written unix >
Now create a file himars.c unix >ule hiworld.c >>>> Holg's ule (Unix Line Editor) V2.0 (04/02/99) >>>> 111111 Lines Maximum! >>>>>>>> FILE :hiworld.c >>>>>>>> # Lines : 4 0E>p 1 20 1.>main() 2.> { 3.> printf("hi world!\n"); 4.> } 4EOF> 0.> 0E>3 3.> printf("hi world!\n"); 3E>c /world/mars/ 3.> printf("hi mars!\n"); 3E>w himars.c >>> FILE <himars.c> 4 Lines Written 3E>q unix >
ERROR MESSAGE:
Whenever (If ever?) you make a syntax error in ule, you will be greeted by: 0E>^ look at me i are smart! - a syntax error! ??? -- You want fries with that? -- ??? 0E> Look i am not a mind reader, i have no idea of whats going on in that pea-brain of yours, i only know that i dont know, and under the circumstances thats as good a responce as any.

That concludes the 5 minute introduction to ule. You should be able to edit a file: print (view), insert, replace, delete, and change lines, as well as create new files from old ones. In short, you have become: MASTER OF YOUR DOMAIN!
GOOD LUCK!
Home