文本处理 (包括C++和shell)
2017-12-08 21:14
405 查看
文本处理
http://bbs.chinaunix.net/forum.php?mod=viewthread&tid=3678518//简单保存一下,方便简单文本的读取和处理 #include <iostream> #include <string> #include <fstream> #include <sstream> using namespace std; int main() { string wavDataIndex = "wavnameList.txt"; ifstream fileIndex(wavDataIndex.c_str()); string wavSongName; static int totalWavSong = 0;//wav文件数 //string SongName = "waveFile\\year2003\\person00002\\00041.wav"; //在基线系统中的wavname,系统中有\\,写出来时是单斜杠 ofstream wavSongNametemp("newNameList.txt", ofstream::app); while (fileIndex >> wavSongName) { totalWavSong++; //去掉三个斜杠,以便读取以此命名的txt wavSongName.erase(wavSongName.find("\\"), 1); wavSongName.erase(wavSongName.find("\\"), 1); wavSongName.erase(wavSongName.find("\\"), 1); wavSongNametemp << wavSongName << endl; } wavSongNametemp.close(); cout << totalWavSong; system("Pause"); return 0; }
相关文章推荐
- 第七章 Shell文本处理三剑客之sed
- Spark机器学习8· 文本处理(spark-shell)
- shell 文本处理三剑客之sed
- shell之文本处理-echo
- shell文本处理
- 常见处理文本的SHELL命令
- shell脚本专家指南--单行文本处理awk
- Linux--shell脚本之文本处理工具
- 第八章 Shell文本处理三剑客之awk
- 常见处理文本的SHELL命令
- shell脚本之正则表达和文本处理(文本处理三剑客:1、grep 2、sed 3、awk)
- shell 脚本之文本处理
- Shell文本处理 (1). bash命令杂项
- 【shell】文本处理的一些小技巧
- 文本处理三剑客之grep(包括常用正则表达式)
- 用shell简单处理文本的例子
- shell 处理文本小技巧
- 编程工具(四)Shell文本处理
- Shell处理文本字符串常用命令
- Shell 常用文本处理命令