mercredi 20 avril 2016

prnting paragraph between two patterns containing specific string. unix shell scripting

I have some data as shown in image input Data

if I'm searching 321 , it should show expected output "something" may have several lines , need all data between < start > and < stop > tags and nothing else

tried below command :

grep * | cut -d":" -f1 | xargs awk '/start/,/stop/' test.txt

but it is giving me all < start > and < stop > tags.

Aucun commentaire:

Enregistrer un commentaire