svnno****@sourc*****
svnno****@sourc*****
2013年 12月 23日 (月) 15:13:37 JST
Revision: 5455 http://sourceforge.jp/projects/ttssh2/scm/svn/commits/5455 Author: yutakapon Date: 2013-12-23 15:13:36 +0900 (Mon, 23 Dec 2013) Log Message: ----------- サンプルコードを追加した。 チケット #32621 テキストファイル内の文字列の削除or置換 Ticket Links: ------------ http://sourceforge.jp/projects/ttssh2/tracker/detail/32621 Modified Paths: -------------- trunk/doc/en/html/macro/command/filereadln.html trunk/doc/ja/html/macro/command/filereadln.html -------------- next part -------------- Modified: trunk/doc/en/html/macro/command/filereadln.html =================================================================== --- trunk/doc/en/html/macro/command/filereadln.html 2013-12-13 17:59:05 UTC (rev 5454) +++ trunk/doc/en/html/macro/command/filereadln.html 2013-12-23 06:13:36 UTC (rev 5455) @@ -69,5 +69,50 @@ fileclose fhandle </pre> +<pre class="macro-example"> +; Search a keyword and replace in the file. +infile = 'testdata.txt' +outfile = 'testdata_output.txt' + +oldkeyword = 'BBB' +newkeyword = 'zzz' + +fileopen ifd infile 0 +fileopen ofd outfile 0 + +while 1 + filereadln ifd line + if result=1 then + break + endif + strreplace line 1 oldkeyword newkeyword + filewriteln ofd line +endwhile + +fileclose ifd +fileclose ofd + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +[testdata.txt] +AABBBCCCCDDDDD +###DDCCCBBBBAAAAA#### +1234567890 + +[testdata_output.txt] +AAzzzCCCCDDDDD +###DDCCCzzzBAAAAA#### +1234567890 +</pre> + + +<h2>Reference</h2> + +<a href="strreplace.html">strreplace</a><br> +<a href="fileopen.html">fileopen</a><br> +<a href="filewriteln.html">filewriteln</a><br> +<a href="fileclose.html">fileclose</a><br> + + </body> </html> Modified: trunk/doc/ja/html/macro/command/filereadln.html =================================================================== --- trunk/doc/ja/html/macro/command/filereadln.html 2013-12-13 17:59:05 UTC (rev 5454) +++ trunk/doc/ja/html/macro/command/filereadln.html 2013-12-23 06:13:36 UTC (rev 5455) @@ -70,5 +70,49 @@ fileclose fhandle </pre> +<pre class="macro-example"> +; \x83t\x83@\x83C\x83\x8B\x82Ɋ܂܂\xEA\x82\xE9\x83L\x81[\x83\x8F\x81[\x83h\x82\xF0\x92u\x8A\xB7\x82\xB7\x82\xE9 +infile = 'testdata.txt' +outfile = 'testdata_output.txt' + +oldkeyword = 'BBB' +newkeyword = 'zzz' + +fileopen ifd infile 0 +fileopen ofd outfile 0 + +while 1 + filereadln ifd line + if result=1 then + break + endif + strreplace line 1 oldkeyword newkeyword + filewriteln ofd line +endwhile + +fileclose ifd +fileclose ofd + +;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; + +[testdata.txt] +AABBBCCCCDDDDD +###DDCCCBBBBAAAAA#### +1234567890 + +[testdata_output.txt] +AAzzzCCCCDDDDD +###DDCCCzzzBAAAAA#### +1234567890 +</pre> + + +<h2>\x8EQ\x8F\xC6</h2> + +<a href="strreplace.html">strreplace</a><br> +<a href="fileopen.html">fileopen</a><br> +<a href="filewriteln.html">filewriteln</a><br> +<a href="fileclose.html">fileclose</a><br> + </body> </html>