我想做这个替换:
"name1"."name2"()="name3"."name4"
使用Sed我试过了:
sed -e 's/\"[[:alpha:]]*\"\.\"[[:alpha:]]*\"\=\"[[:alpha:]]*\"\.\"[[:alpha:]]*\"//g'
NeronLeVelu建议的解决方案
echo '"NAME1"."NAME2"="NAME3"."NAME4"'|sed -e 's/"[[:alnum:]]*"\."[[:alnum:]]*"="[[:alnum:]]*"\."[[:alnum:]]*"//g'
它只使用一次:
但是在一个更复杂的字符串中不起作用...... :-( 在--AIX 6 1 ---
>cat /tmp/bbbb
case when "D"."COD_COMP"="B"."COD_COMP" AND "D"."COD_CNL"="B"."COD_CNL" AND "D"."COD_PUN"="B"."COD_PUN" AND "D"."COD_UNTA"="B"."COD_UNTA"
>cat /tmp/bbbb|sed -e 's/"[[:alnum:]]*"\."[[:alnum:]]*"="[[:alnum:]]*"\."[[:alnum:]]*"//g' case when "D"."COD_COMP"="B"."COD_COMP" AND "D"."COD_CNL"="B"."COD_CNL" AND "D"."COD_PUN"="B"."COD_PUN" AND "D"."COD_UNTA"="B"."COD_UNTA" –
任何人都可以帮助我?
答案 0 :(得分:0)
sed -e 's/"[[:alnum:]_]*"\."[[:alnum:]_]*"\(()\)\{0,1\}="[[:alnum:]_]*"\."[[:alnum:]_]*"\([[:space:]]\{1,\}AND[[:space:]]\{1,\}\)\{0,1\}/YourReplacementString/' YourFile
"
,=
[:alnum:]
代替[:alpha:]
_-
()
AND
(如果有)