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.
実行してテキストファイルに出力するbashスクリプトがありますが、使用するカラーコードも含まれています.ファイルからそれらを削除する方法を知りたいです.
^[[38;1;32mHello^[[39m ^[[38;1;31mUser^[[39m
Hello と User だけ残したいので、sed -r "special characters" from file A save to file B
sed 's/\^\[\[[^m]*m//g'
^[[行の最初の部分まで(すべて) 削除するm
^[[
m
このようないくつか:
awk '{sub(/\^\[\[38;1;[0-9][0-9]m/,x);sub(/\^\[\[39m/,x)}1' Hello User