How can replace this using sed? -
i'm using os x, want replace
[self.lang getapplanguagestring:@"foo bar"]
to
localizedstring(@"foo bar", nil)
i use sed below:
sed -i '' s/[self\.lang getapplanguagestring:@"([a-za-z]+)"]/localizedstring(@"\1", nil)/g somefile
but not work, how can that?
you've escaped .
in pattern, need escape [
, ]
.
try:
sed -i 's/\[self\.lang getapplanguagestring:@\("[^"]*"\)\]/localizedstring(@\1, nil)/' somefile
Comments
Post a Comment