The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




View Single Post in the UNIX and Linux 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!