小编Ear*_*sui的帖子

sed 替换变量包含换行符(保留它)

我有一个从网上下载的多行字符串:

toast the lemonade
blend with the lemonade
add one tablespoon of the lemonade
grill the spring onions
add the lemonade
add the raisins to the saucepan
rinse the horseradish sauce
Run Code Online (Sandbox Code Playgroud)

我已将其分配给$INPUT,如下所示:

toast the lemonade
blend with the lemonade
add one tablespoon of the lemonade
grill the spring onions
add the lemonade
add the raisins to the saucepan
rinse the horseradish sauce
Run Code Online (Sandbox Code Playgroud)

此时,$INPUT已准备好替换到我的目标文件中,如下所示:

INPUT=$(lynx --dump 'http://example.net/recipes' \
     | python -m json.tool \
     | awk '/steps/,/]/' \ …
Run Code Online (Sandbox Code Playgroud)

sed

6
推荐指数
1
解决办法
5236
查看次数

标签 统计

sed ×1