1

sed edit text block: not greedy match

view story
linux-howto

http://unix.stackexchange.com – I wish I can grab the first html comment in a file using sed. Using '/<!--/,/-->/ and having more than one comment block it will match all the content between the first and the last comment block too! Any advice? Here a sample: <!-- First comment block --> Content <!-- Second comment block --> The expected output should be: <!-- First comment block --> It should work with single line comments too. <!-- First comment block --> (HowTos)