#1
  1. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2002
    Location
    Orlando FL
    Posts
    130
    Rep Power
    13

    Question cat section of files


    Hi everyone,

    Is there an option for cat or similar command to show section of an file by given lines numbers? For example I want to display only line from 10 to 23 of file.txt.
    Thanks
    Help me, help you, help others...
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Feb 2003
    Posts
    52
    Rep Power
    12
    head and tail are your friends. For the example you gave:
    Code:
    tail +10 <file.txt | head -15
    In other words, start at line 10 of file.txt and show 15 lines (10-23, inclusive). Hope that helps.
  4. #3
  5. Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Sep 2002
    Location
    Orlando FL
    Posts
    130
    Rep Power
    13

    Thumbs up


    works like a charm! thank you!
    Help me, help you, help others...

IMN logo majestic logo threadwatch logo seochat tools logo