How do i substitute ' with space in a file using sed or awk
i am getting the following two scenarios
1) xyz'd with xyz d
if i use
sed 's/xyz\\\'d/xy z/g'
it is taking ' after \ as closing expr for substitution
2) xyz';d with xyz d
please advice
Thanks but it is replacing all the ' appearing in the file
i want to replace only for cases below
1) xyz'd with xyz d
2) xyz';d with xyz d
i tried
tr "xyz\'d" "xyz d" < file
still it is replacing all the occurence of '
kshji:
sed "s/xyz'd/xyz d/g"
sed "s/xyz\('\|';\)d/xyz d/g"
kshji
August 2, 2009, 4:54am
6
kshji:
sed "s/xyz'd/xyz d/g"
You can use like dr.house has done or give two rule:
sed -e "s/xyz'd/xyz d/g" -e "s/xyz';d/xyz d/g"
Not so "guru" rule, but very readable.
bingo!!, worked great
and how to replace
xyz\'d with xyz d
xyz\;d with xyz d
u can just make a little modification to the previous post and escape the "\" with "\".