Mercurial > forge
view admin/split_docstrings @ 9720:1f2353e3e587 octave-forge
control-devel: quicksave id draft code (2)
author | paramaniac |
---|---|
date | Thu, 15 Mar 2012 20:04:50 +0000 |
parents | 3933841dc7f8 |
children |
line wrap: on
line source
#!/bin/sh file=$1 cat <<EOF | octave -q fid = fopen("$file","rt"); text = char(fread(fid,Inf,'uchar')); fclose(fid); section = [find(text == char(31))]; line = find(text == "\n"); section(length(section)+1) = line(length(line)) + 1; for idx=1:length(section)-1 lineend = min(line(line>section(idx))); name = text(section(idx)+1:lineend-1); body = text(lineend+1:section(idx+1)-1); fid = fopen(name',"wt"); fwrite(fid, body, 'uchar'); fclose(fid); end