careers
blog
Display a block of text with delineated by a start pattern and an end pattern
Hot:sun Display a block of text with delineated by a start pattern and an end  patternsun dark Display a block of text with delineated by a start pattern and an end  patternsun dark Display a block of text with delineated by a start pattern and an end  patternsun dark Display a block of text with delineated by a start pattern and an end  patternsun dark Display a block of text with delineated by a start pattern and an end  pattern

Taken idea from commandlinefu.com

The command will display a segment from the file from the start pattern to the end pattern.

function viewsegment() { tail -n +`fgrep -n -m 1 "$1" $3 | head -`fgrep -n -m 1 "$2" $3 }
Display a block of text with delineated by a start pattern and an end pattern

Share and Enjoy:
  • Print
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google Bookmarks
  • blogmarks
  • Blogosphere News
  • co.mments
  • HelloTxt
  • Ping.fm
  • Reddit
  • RSS
  • StumbleUpon
  • Suggest to Techmeme via Twitter
  • Technorati
  • Twitter
  • Yahoo! Bookmarks
  • Add to favorites
  • BlinkList
  • Diigo
  • email
  • Identi.ca
  • LinkedIn
  • Live
  • MyShare
  • MySpace
  • PDF
  • SheToldMe
  • Slashdot
  • Socialogs
  • Tumblr

related post

CBA0E3ABEB1A7038A3FD2A47BA03BC1B Display a block of text with delineated by a start pattern and an end  pattern

Technorati Tags: awk, bash, function, sed, segment

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

No comments yet, be the first!

Leave a reply
tools

Back to top

about
notice