* * SPLITTER.KEX * * Selectively split each line of the file wherever the specified string * is located. You are prompted at each occurrence of the string and given * the option of splitting the line, skipping to the next occurrence or * exiting the macro entirely. * * Works with: * * KEDIT for Windows 1.5 * KEDIT 5.0 for DOS * KEDIT 5.0 for OS/2 * * To invoke this macro, enter the following on the KEDIT command line: * * splitter /string * parse arg target if target = "" then do "emsg SPLITTER Error 1: You must specify a string target" exit 1 end * Save current SET options 'preserve' * We want target searches to span lines but not to wrap to the top of the file 'set stream on' 'set wrap off' 'top' * Abort if the target isn't initiall found 'clocate' target if rc > 0 then exit rc do forever * Let the user decide if we should split say 'Split here? (Y/N/Esc)' do forever 'readv key' if pos(readv.1,'S-Y S S-N N ESC') > 0 then leave 'emsg Split here? (Y/N/Esc)' end if readv.1 = 'ESC' then leave if readv.1 = 'Y' | readv.1 = 'S-Y' then do 'split aligned' 'clocate' target end 'clocate' target if rc \= 0 then leave end * Restore initial SET options 'restore'