how to extract text which matches particular fields in text file using linux commands
问题 Hi below is my text file {"Author":"john" "subject":"java" "title":"java cook book.pdf"} {"title":"Php book.pdf" "Author":"Smith" "subject":"PHP"} {"Author":"Smith" "title":"Java book.pdf"} from the above data i want to extract all titles which contains "java" word, i should get the following output java cook book.pdf Java book.pdf Please suggest me Thanks 回答1: GNU sed sed -r '/title.*java/I!d;s/.*:.(.*).}$/\1/' file java cook book.pdf Java book.pdf 回答2: You can try something like this with