How to get all open strings from .h and .m files Xcode

173 Views Asked by At

I want to create excel of all open strings @"..." in .h and .m files throughout my project. To standardise strings across platform. Is there any tool to get strings ? I used genstrings but it only finds localized strings.

2

There are 2 best solutions below

0
On BEST ANSWER

You need to install BREW first and then GNU grep. -p no longer works with current grep in osx. http://www.heystephenwood.com/2013/09/install-gnu-grep-on-mac-osx.html

I used following command after installing GNU grep

 grep -rPo --no-filename --include='*.m' '(?<=@")(.*)(?=")'  *  >> outfile.txt

regex is not proper but still manageable.

1
On

One option can be using 'grep' command recursively on all files in ur project folder ending with .h and .m

Something like:

grep -Po '@" \K.*(?= ")' inputfilename.h > outfile.txt

The result will be saved in the file outfile.txt. I have not tested it personally but you can give it a try...