bash - 读取文本文件和逐行打印的问题

时间:2014-07-02 20:34:22

标签: bash shell unix

我在输出列表中打印每一行时遇到问题。

内容如下:

我的文本文件,如果你cat它有一个如下所示的字符串:

YYYYMMDD - ABCD B-1B DCI (Foo) Meeting Minutes - Template

但是我的输出是将每个项目打印成一行,如下所示:

I want to print this line:YYYYMMDD
I want to print this line:-
I want to print this line:ABCD
I want to print this line:B-1B
I want to print this line:DCI
I want to print this line:(Foo)
I want to print this line:Meeting
I want to print this line:Minutes
I want to print this line:-
I want to print this line:Template

如何修复此问题以便打印出每个字符串?

这是我的代码:

    PGLIST="pglist.lst";
    PGS=`cat $PGLIST`;

    #Create a list from executing this script
    ./confluence.sh $CMD_PGLIST $CMD_SPACE "$1" > "$PGLIST"

    #Print out lines
    for line in $PGS; do
        echo "I want to print this line:$line"
    done

0 个答案:

没有答案