Reputation: 139
I'm using OS X, want to replace
[self.lang getAppLanguageString:@"foo bar"]
to
LocalizedString(@"foo bar", nil)
I use sed like the below:
sed -i '' s/[self\.lang getAppLanguageString:@"([a-zA-Z]+)"]/LocalizedString(@"\1", nil)/g somefile
but not work, how can I do that?
Upvotes: 1
Views: 68
Reputation: 123688
You've already escaped .
in the pattern, but also need to escape [
and ]
.
Try:
sed -i 's/\[self\.lang getAppLanguageString:@\("[^"]*"\)\]/LocalizedString(@\1, nil)/' somefile
Upvotes: 1