而不是文本被拆分,pwd重复文本

问题描述 投票:1回答:1
    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"

提前谢谢,节奏

bash macos shell macos-sierra
1个回答
0
投票

你可以尝试一下。

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

要么

your_fold_command | awk '{$1=$1}1' OFS="\n" 
© www.soinside.com 2019 - 2024. All rights reserved.