Unix Question....

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • daddy321
    Registered User
    • Jul 2005
    • 22

    #1

    Unix Question....

    Hi guys, I like to display/print a specific number from a file with unix command. how do I do that? (not in vi editor)

    For example, all I know is line number...e.g.: 2314th line. File is huge like 3gig. I wanna see just one line. Which unix command(s) can show me that?

    thanks
  • Big E
    Registered User
    • Mar 2002
    • 935

    #2
    tail -2314 [file] | head -n 1

    Comment

    • prodiac
      Confirmed User
      • Sep 2003
      • 419

      #3
      Originally posted by Big E
      tail -2314 [file] | head -n 1
      That'd pull the last 2314 lines of the file, and print the first one in that list. So I think you'd want to use that backwards, head -2314 [file] | tail -1

      Comment

      • daddy321
        Registered User
        • Jul 2005
        • 22

        #4
        Guys. thank you so much. you saved me a lot. BOTH WORKS FOR ME!!

        Comment

        Working...