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

Popular posts from this blog

java.util.scanner - How to read and add only numbers to array from a text file -

rewrite - Trouble with Wordpress multiple custom querystrings -