Oct 26, 2004 #1 BryanY MIS Aug 18, 2001 54 US I want to pull the data from the second line of a file. How would a specify to do that?
Oct 26, 2004 #2 PHV MIS Nov 8, 2002 53,708 FR Different ways: awk 'NR==2{print;exit}' /path/to/input sed '2{;p;q;}' /path/to/input tail -n +2 /path/to/input | head -1 Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244 Upvote 0 Downvote
Different ways: awk 'NR==2{print;exit}' /path/to/input sed '2{;p;q;}' /path/to/input tail -n +2 /path/to/input | head -1 Hope This Helps, PH. Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
Oct 26, 2004 #3 olded Programmer Oct 27, 1998 1,065 US Or simply let the shell do it, korn shell in this case: #!/bin/ksh i=0 while read line do ((i=$i+1)) (( $i == 2 )) && break done < myfile echo ${line} Regards, Ed Upvote 0 Downvote
Or simply let the shell do it, korn shell in this case: #!/bin/ksh i=0 while read line do ((i=$i+1)) (( $i == 2 )) && break done < myfile echo ${line} Regards, Ed
Oct 27, 2004 #4 mrn MIS Apr 27, 2001 3,993 GB Not pretty but effective head -2 /etc/hosts > /tmp/look.file|tail -1 /tmp/look.file Mike "A foolproof method for sculpting an elephant: first, get a huge block of marble, then you chip away everything that doesn't look like an elephant. Upvote 0 Downvote
Not pretty but effective head -2 /etc/hosts > /tmp/look.file|tail -1 /tmp/look.file Mike "A foolproof method for sculpting an elephant: first, get a huge block of marble, then you chip away everything that doesn't look like an elephant.