Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
sedを使用して、入力文字列9872を変更するにはどうすればよいですか39 38 37 329872.
9872
39 38 37 32
9872.
入力文字列:
必要な出力:
echo 9872 | sed 's/./3&\ /g'
完全を期すために、正規表現参照を使用するより一般的な方法を示します。
echo 9872 | sed -r 's/([[:digit:]])/3\1 /g'
$ echo "9872" | sed 's/[0-9]/3& /g' 39 38 37 32