The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Operating Systems > Linux
Google UNIX.COM



View Single Post in UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #1 (permalink)  
Old 07-06-2007
lunchtime lunchtime is offline
Registered User
 

Join Date: Jun 2007
Posts: 8
Command that prints content of line5, or similar?

Hello all;

I've been having trouble completing a script (bash) because I can't get past the issue of finding a line in a file. For example, I have a file like this:

ddmmmyyyy Lon Lat
24may2003 -100.0 24.1
25may2003 -100.1 24.0
28may2003 -99.5 23.2
....etc
05jun2003 -97.0 22.7
EOF

I'm making a loop, and I need a way to call a line number without specifying what the line contains (i.e., grep doesn't work). Here's what I had in mind:

n=2
While (something that makes the loop infinite); do
day=`command line${n} word1


if
Reply With Quote
Remove advertisements
!!
Forum Sponsor