LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   for in sed (https://www.linuxquestions.org/questions/linux-newbie-8/for-in-sed-643426/)

jkeertir 05-20-2008 01:58 AM

for in sed
 
Dear all,

I am trying to copying a specfic line of a file to a differnt file.
i am using this script


#/bin/sh
for i in `seq 1 $v1`
do
`sed -n '$i'p /k >/kk`
done

i m not able to execute .it is giving me error.
where $v1 is line count for /k1 file.


Please can anyone help me to solve this issue.
With Regards,
Keerti

acid_kewpie 05-20-2008 02:15 AM

you shouldn't have backticks on the sed command. why have you got them there? that means that it's going to run the output of the sed command, not just the command itself. the are backticks around the seq as that is what you want, i.e. generate a sequence and use that in the for loop, e.g. that seq's output is 1 2 3 4, which makes that for command "for i in 1 2 3 4"


All times are GMT -5. The time now is 03:18 AM.