The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM



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

Join Date: Apr 2007
Posts: 3
use variable for sed print line

I'm using the sed command to pull a line from a file and place it into another file:

sed -n '1p' students >tmp

this pulls the first line, I want to change the 1 to a variable which will be a counter to go through the rest of the lines but can't get it. I've tried:

sed -n '$cp students >tmp
sed -n $cp students >tmp

neither work. Any ideas? Thanks!
Reply With Quote
Forum Sponsor