• About My website
  • Search

Amit Agarwal Linux Blog

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

2009-12-18 1 min read Bash

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

Awk Bash Function Sed Segment
Latest posts
  • Building and Breaking a Vulnerable Active Directory Lab: Full Exploitation Walkthrough
  • Run a Local LLM API Server with vLLM (OpenAI-Compatible, Fast, and Simple)
  • Fixing NXC Not Showing Passwords During Brute Force Password Sprays
  • Golden Ticket Attack: Exploiting Kerberos from Linux
  • Color-Coded URL Status Checker in Bash: Enhanced Script for Fast Web Health Monitoring
  • Mobile_App_Mindmap
  • Check Price and Token Limits in ZapGPT with OpenAI Provider
Categories
  • Linux (529)
  • Fedora (343)
  • Bash (216)
  • Uncategorized (191)
  • Learning (156)
  • Photo (76)
  • Vim Tips (37)
Social media
© 2018 - 2025 by Amit Agarwal - rss
Bilberry Hugo Theme