Variable substitution in sed

From: aji e theyyunni (aji.theyyunni@wipro.com)
Date: Sat Oct 20 2007 - 06:09:43 EDT


Hi all,

 

I am Aji. I have a doubt in sed's variable substitution.

 

Problem

 

        i=1

        j=13

        

        sed -n 's/"${i}/${j}"/p' temp

 

I have initialized i and j as above. But when i am using this variables in
sed command to display the contents (first 13 lines) of the file which is
temp here (which is having more than 50 entries), I am not getting any
output. Exit status of this sed command is 0.

 

So can anyone provide me the way to solve this issue? Can you please check
whether that variable substitution that I have used is correct or not
.Please reply to me today itself .Its very urgent.

 

This is the output of the sed command without variable substitution.

 

sed -n '1,13p' temp

PROC_APP_ID

PROC_CPU_CSWITCH_TIME

PROC_CPU_CSWITCH_UTIL

PROC_CPU_INTERRUPT_TIME

PROC_CPU_INTERRUPT_UTIL

PROC_CPU_NICE_TIME

PROC_CPU_NICE_UTIL

PROC_CPU_NORMAL_TIME

PROC_CPU_NORMAL_UTIL

PROC_CPU_REALTIME_TIME

PROC_CPU_REALTIME_UTIL

PROC_CPU_SYSCALL_TIME

PROC_CPU_SYSCALL_UTIL

 

Thanks and Regards

Aji E Theyyunni

The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.

WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
 
www.wipro.com
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 23:42:27 EDT