この部分的な SQL 文字列があります。
select ID,to_char(ts2date(created_t),'DD-MM-YYYY'),name,segment_code from sometable
sed を使用して、一番外側の括弧の外側にあるカンマを文字列 '~' に置き換えようとしました。
望ましい結果は次のとおりです。
select ID~to_char(ts2date(created_t),'DD-MM-YYYY')~name~segment_code from sometable
これが私が試したものです:-
sed '
:a
s/[,]\(.*(\)/~\1/g
s/\().*\)[,]/\1~/g
ta
しかし、結果は次のようになります:-
select ID~to_char(ts2date(created_t)~'DD-MM-YYYY')~name~segment_code from sometable
一番外側の括弧内のコンマを無視するにはどうすればよいですか?
どんな答えでもTQ.. :)