tech.gate.io blog

grep for a whole paragraph

what to do if you want to grep for a string in a file, and want to get the whole stanza/paragraph where the string was found in?

there is a very simple AIX-solution, and a bit more complicated one with sed:

 
a sample textfile:

# cat testfile
start
1
value
end

start
2
end

start
3
foo
end

start
4
end

 

  • AIX grep
# grep -p foo testfile
start
3
foo
end
  • sed
# sed -e '/./{H;$!d;}' -e 'x;/foo/!d;' testfile

start
3
foo
end

 

65 comments


private message
grep -p is not available in HPUX


private message

Paki, aunque con retraso, te comunico que todos los que lo solicist teis a trav s de los coemntarios est is admitidos/as

car insurance quotes buy auto insurance online



private message

I love that sweater with the short shorts, tights, and boots. You're the second blogger I've seen rocking that particular look, both of you very differently. It makes me want a big hand knitted sweater. (Hmmmm, maybe I can press my mother in law into service?)Heather Fonseca recently posted..

tramadol auto insurance quotes



private message

Hazel thanks for your note. (LOVE The Sartorialist!!). All black is often the default colour because it's the easier to unify (imagine an ensemble full of slightly different shades of red), it's easy on the eyes, and the audience tends to focus more on the music than if the ensemble were wearing different colours. The problem with saying go for it, wear any colour is what one person considers stylish another will consider completely inappropriate. There there's the issue of colour clashing. And in classical music, there are known stereotypes about what kind of dress is associated with certain types of music. Opera performers (and audiences) tend to go all out with style and flamboyance; Baroque performers (and audiences) tend not to consider fashion a big deal and are very low-key with their apparel. Ultimately, no, I don't think ensembles should be able to wear any colour; then it looks like a rehearsal.

auto insurance rates cialis tablet



private message

Once upon a time, I turned pages for Jamie when he performed the Kreutzer Sonata at a studio class. This was before I played it myself, so I was unfamiliar with the theme & variations movement. There's one particular variation which is 2 straight pages of 16th notes, and 2 repeats. I made the mistake of glancing away from the page for a second, and discovered to my horror when I looked back that I couldn't remember a) where we were, and b) whether we had done the repeats. I ended up half-standing & hovering for what seemed like an eternity, with Jamie kindly giving me subtle no shakes and finally a clear yes nod.Then there was the time that I turned for a friend playing in a vocal recital @ Scotiafest. He asked me at the last minute as a favour, so I accepted, forgetting that I was battling the remnants of a nasty cough. There's nothing like being on stage and NOT BEING ALLOWED TO COUGH that will make you want to cough up a lung. I managed to get through the entire thing without once coughing during a piece, but then had a friend in the audience comment on the odd expression on my face at various times.

cheap auto insurance quotes where to buy cialis



Page: 1/7  [Next]
1  2  3  4  5  6  7 

Post new comment

Anti-Bot verification code image
Try another code

Last blog post comments

  1. xymon netapp vfiler quota monitoring: rvksjfq sjmgafs 01:26 CEST
  2. Use Windows as router / NAT traffic: vnvrfihp muygzxbi Sat 19 of May, 2012 16:18 CEST
  3. mount nfs v3 share under Solaris 10: kdvwtux xqowacnm Sat 19 of May, 2012 04:21 CEST
  4. Unix Color Terminal: cbeusw ejbpsnr Sat 19 of May, 2012 01:29 CEST
  5. AIX: Get PVID directly from hdisk using od: buy penis enlargement penis_enlargement Fri 18 of May, 2012 15:14 CEST
  6. AIX: Get PVID directly from hdisk using od: risperdal risperdal Fri 18 of May, 2012 13:00 CEST
  7. AIX: Get PVID directly from hdisk using od: cheap phen375 phen375 Wed 16 of May, 2012 18:30 CEST
  8. AIX: Get PVID directly from hdisk using od: Good info Pharmk935 Mon 14 of May, 2012 23:06 CEST
  9. Unix Color Terminal: Good info Pharmd119 Sun 13 of May, 2012 15:49 CEST
  10. Test network throughput without disk or cpu distortion: Good info Pharmd585 Sun 13 of May, 2012 06:01 CEST

Feeds List