【发布时间】:2012-12-13 16:24:05
【问题描述】:
我想根据某个标签读取文件并从中提取信息。例如:
SCRIPT_NAME:mySimpleShell.sh
This is a simple shell. I would like to have this as
Description. I also want to create a txt file our of this.
SCRIPT_NAME:myComplexShell.sh
This is a complex shell. I would like to have this as
Description. I also want to create a txt file our of this.
所以当我将此文件传递给我的 shell 脚本时,我的 shell 将逐行读取它并 当它到达 SCRIPT_NAME 时,将其提取并保存在 $FILE_NAME 中,然后开始写入 磁盘上具有 $FILE_NAME.txt 名称的文件的描述。它会一直这样做,直到它到达文件的末尾。如果有 3 个 SCRIPT_NAME 标签,则创建 3 个描述文件。
感谢您提前帮助我:)
【问题讨论】:
标签: parsing shell text-extraction