简体   繁体   中英

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

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.

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...

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM