Sed command help

Hi,

I am using variable in sed command to pickup lines between start and end lines using following command. But its giving me this error.Can someone please help me?

sed -n "${start_line},${total_lines}w test_alert1.log" alert_$ORACLE_SID.log

==> ./alert_check1.ksh
sed: command garbled: 353, 442w test_alert1.log

Malay

Try this.

sed -n -e "${start_line},${total_lines}" alert_$ORACLE_SID.log > test_alert1.log

:frowning: Its not working.

Unrecognized command: 353,442

Malay

Try this.

sed -n -e "${start_line},${total_lines}p" alert_$ORACLE_SID.log > test_alert1.log

Still not working. Not identifying variables then.

malay
:frowning:

Look at this

sh-2.05b$ START=1
sh-2.05b$ END=10
sh-2.05b$ sed -n -e "${START},${END}p" libvex.h 

/*---------------------------------------------------------------*/
/*---                                                         ---*/
/*--- This file (libvex.h) is                                 ---*/
/*--- Copyright (C) OpenWorks LLP.  All rights reserved.      ---*/
/*---                                                         ---*/
/*---------------------------------------------------------------*/

/*
   This file is part of LibVEX, a library for dynamic binary
sh-2.05b$ 

vino