I have a sample textfile(test_long_sentence.txt) below and I want to grep all the lines that contain test1 excluding unwanted data.
How do I grep the data before the quote closes?
test_long_sentence.txt
This is some unwanted data blah blah blah
20 /test1/catergory="Food"
20 /test1/target="Adults, \"Goblins\", Elderly,
Babies, \"Witch\",
Faaries"
20 /test1/type="Western"
This is some unwanted data blah blah blah
20 /test1/theme="Halloween"
Command:
grep "test1" test_long_sentence.txt
Actual Output:
20 /test1/catergory="food"
20 /test1/target="Adults, \"Goblins\", Elderly,
20 /test1/type="Western"
20 /test1/theme="Halloween"
Expected Output:
20 /test1/catergory="food"
20 /test1/target="Adults, \"Goblins\", Elderly,
Babies, \"Witch\",
Faaries"
20 /test1/type="Western"
20 /test1/theme="Halloween"
Ps: I have no control in editing the test_long_sentence.txt. So please, do not ask me to edit it to a single line.