pwd不会复制文本,而是复制文本

时间:2018-09-16 14:01:16

标签: bash macos shell macos-sierra

    echo Would you like to upgrade to osu!lazer version number: $x3
    read -r -p "Type [Y/N] to confirm decision: " response
    case "$response" in [yY][eE][sS]|[yY])\
    clear
    rm -f ~/Documents/lazerversion.txt 
    echo $x3 >> ~/Documents/lazerversion.txt 
    echo osu!lazer Updater
    echo -----------------
    echo Updating.
    x4=$(sed -n '/browser_download_url/p' ~/Documents/releasefull.txt | head -2)
    echo $x4 >> ~/Documents/tempresult.txt
    fold -s -w80 ~/Documents/tempresult.txt
    ;;
*)
    clear
    echo osu!lazer Updater
    echo -----------------
    echo Goodbye.
    ;;
esac

问题是fold -s -w80 ~/Documents/tempresult.txt

"browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/install.exe" "browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/osu.app.zip"
"browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/install.exe" "browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/osu.app.zip"
"browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/install.exe" "browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/osu.app.zip"
"browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/install.exe" "browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/osu.app.zip"
"browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/install.exe" "browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/osu.app.zip"
"browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/install.exe" "browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/osu.app.zip"
"browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/install.exe" "browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/osu.app.zip"
"browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/install.exe" "browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/osu.app.zip"
"browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/install.exe" "browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/osu.app.zip"
"browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/install.exe" "browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/osu.app.zip"

我收到上面的文字。

我想要这个:

"browser_download_url":
"https://github.com/ppy/osu/releases/download/2018.915.0/install.exe" 
"browser_download_url":
"https://github.com/ppy/osu/releases/download/2018.915.0/osu.app.zip"

上面的文本在各自的单独行中。

我使用fold -s -w80 ~/Documents/tempresult.txt的方式有什么问题

我想分成几行的原文是

"browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/install.exe" "browser_download_url": "https://github.com/ppy/osu/releases/download/2018.915.0/osu.app.zip"

预先感谢, 节奏

1 个答案:

答案 0 :(得分:0)

请您尝试一次。

awk '{$1=$1}1' OFS="\n"  Input_file

OR

your_fold_command | awk '{$1=$1}1' OFS="\n"