Handy to know shizzle

A collection of handy to know things, mainly in the IT space

Sunday, April 13, 2008

extract a range of lines from a file

problem:
You want to extract a range of lines from a file

solution:
sed comes to the rescue here! the following would print the line range from filename to stdout
sed -n '5,8p;8q' filename
5 = from line 5, including 5
8p = to line 8 including 8
8q = stop processing and quit

citation:
http://linuxactivist.blogspot.com
Posted by Ky at 03:02
Email ThisBlogThis!Share to TwitterShare to FacebookShare to Pinterest
Labels: sed

No comments:

Post a Comment

Newer Post Older Post Home
Subscribe to: Post Comments (Atom)

Blog Archive

  • ►  2023 (7)
    • ►  February (2)
    • ►  January (5)
  • ►  2022 (4)
    • ►  December (1)
    • ►  February (3)
  • ►  2021 (2)
    • ►  February (1)
    • ►  January (1)
  • ►  2020 (1)
    • ►  December (1)
  • ►  2019 (2)
    • ►  October (2)
  • ►  2018 (1)
    • ►  May (1)
  • ►  2017 (2)
    • ►  September (1)
    • ►  July (1)
  • ►  2015 (1)
    • ►  March (1)
  • ►  2014 (1)
    • ►  April (1)
  • ►  2013 (1)
    • ►  March (1)
  • ►  2012 (18)
    • ►  September (1)
    • ►  August (1)
    • ►  July (4)
    • ►  May (3)
    • ►  April (4)
    • ►  March (4)
    • ►  February (1)
  • ►  2011 (11)
    • ►  December (2)
    • ►  November (1)
    • ►  August (5)
    • ►  July (2)
    • ►  February (1)
  • ►  2010 (9)
    • ►  December (5)
    • ►  October (1)
    • ►  September (2)
    • ►  August (1)
  • ►  2009 (1)
    • ►  November (1)
  • ▼  2008 (3)
    • ▼  April (3)
      • extract a range of lines from a file
      • native overburning in os x
      • os x screen wuff — wuff

About Me

Ky
View my complete profile
Powered by Blogger.