Is there a simple way to extract strings from code i.e. the content of a double quotes?
source:
a = "somestring"
result:
somestring
Fred Foo's answer solves the essential problem. Expanding to report across a directory tree, and to report the file name on each output line even if multiple strings occur on the same line:
find . -name '*.java' | xargs egrep -o '"([^"]*)"' |\
awk '/:"/ {j=$0;sub(/:.*/,"",j);print;}!/:"/{print j ":" $0}' |\
sed 's/"\(.*\)"/\1/'
Simple first attempt:
egrep -o '"([^"]*)"' sourcefile | sed -r 's/"(.*)"/\1/'