Results 1 to 5 of 5
  1. #1
    Join Date
    Jun 2004
    Posts
    46

    Unanswered: to read middle of a file

    How to read lines 500 to 2000 in a 10000 record file and put in a seperate file using sed or awk.


    Thanks
    mark jason.

  2. #2
    Join Date
    Apr 2004
    Location
    Boston, MA
    Posts
    325
    Code:
     sed -n '500,2000p' input > output
    OR
     sed '500,2000!d'  input > output
    vlad
    +-----------------------+
    | #include <disclaimer.h> |
    +-----------------------+

  3. #3
    Join Date
    Jun 2004
    Posts
    46
    Thanks, but my question phrasing was wrong.

    i want to search for ceratain words in a file like MILE in first column and assign its 5th column to a variable and if it don't find that word in other lines then i should assign '0' to a variable.

    Hope this is clear

    Thanks
    mark

  4. #4
    Join Date
    Jun 2003
    Location
    West Palm Beach, FL
    Posts
    2,713

    Thumbs down

    Quote Originally Posted by markjason
    How to read lines 500 to 2000 in a 10000 record file and put in a seperate file using sed or awk.
    Thanks
    mark jason.
    Quote Originally Posted by markjason
    Thanks, but my question phrasing was wrong.
    i want to search for ceratain words in a file like MILE in first column and assign its 5th column to a variable and if it don't find that word in other lines then i should assign '0' to a variable.
    Hope this is clear
    Thanks
    mark
    As clear as muddy waters, here is your answer.
    The person who says it can't be done should not interrupt the person doing it. -- Chinese proverb

  5. #5
    Join Date
    Jun 2004
    Posts
    46
    Thanks

    I found what i want from your answer

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •