[發案] DOS檔案字串處理(已結案)

作者: dearaquarius (亂青春)   2016-07-20 14:22:56
凡是「*[30m」開始的行,都請使用 Ctrl + y 刪除。
如果對於發案文章格式有不清楚的地方,請參考置底文章:[發案] 發案範例
 發案人:吳先生
聯絡方式1:Line:dearaquarius
聯絡方式2:站內信
所在地區 :桃園
有效時間:7/24
專案說明:
功能a. 搜尋字串出現次數 並設定參數 set Str_Count=QTY
功能b. 將搜尋字串內容做替換 (若有重複可指定第幾個 無指定則全部替換)
功能c. 將搜尋字串後的內容 並指定byte做替換
功能d. 將搜尋字串後的內容 指定byte設定成參數 set Str_par=Parameter
功能e. 算術計算 加減乘除, 開根號
功能f. 指定行數 刪除/插入 內容
功能G. 指定位置 刪除/插入 內容
Ex:
File name Test.txt
======================================
apple:12345
beer
cat
dog
apple:45678
beer
cat
apple:13579
======================================
a. 執行 FileTool /sq Test.txt "apple"
echo %Str_Count%
結果 3
b. 執行 FileTool /r Test.txt Test2.txt "apple" "APPLE"
Type Test2.txt
結果
APPLE:12345
beer
cat
dog
APPLE:45678
beer
cat
APPLE:13579
c. 執行 FileTool /rb 2-3 Test.txt Test2.txt 3 "apple:" 246810
Type Test2.txt
結果
apple:12345
beer
cat
dog
apple:45678
beer
cat
apple:124681079
d. 執行 FileTool /par 2-3 Test.txt 3 "apple:"
echo %Str_par%
結果 35
e. 執行 FileTool /cal "(123+15/5)*2"
echo %Str_Cal%
結果 63
f. 執行 FileTool /del_row 3 Test.txt Test2.txt
Type Test2.txt
結果
apple:12345
beer
dog
apple:45678
beer
cat
apple:246810
執行 FileTool /ins_row 3 Test.txt Test2.txt "ZooZooZoo"
Type Test2.txt
結果
apple:12345
beer
ZooZooZoo
dog
apple:45678
beer
cat
apple:246810
g. 執行 FileTool /del_pos 3-8 Test.txt Test2.txt
Type Test2.txt
結果
ap345
beer
dog
apple:45678
beer
cat
apple:246810
執行 FileTool /ins_pos 3 Test.txt Test2.txt "ZooZooZoo"
Type Test2.txt
結果
apZooZooZoople:12345
beer
ZooZooZoo
dog
apple:45678
beer
cat
apple:246810
  預算:口袋不深 請報價
接案者要求:
  附註:
作者: p2k (pank)   2016-07-20 23:00:00
環境是純 DOS 還是 Windows 下的 CMD 視窗?
作者: shadowjohn (轉角遇到愛)   2016-07-20 23:44:00
http://3wa.tw/myimage/index.php?id=147 這樣嗎?e 的執行結果應該為 252 請確認一下 ?已完成~可跟我聯絡XD花了2小時…前半部研究env真搞工

Links booklink

Contact Us: admin [ a t ] ucptt.com