Operating System - Linux
1754014 Members
7566 Online
108811 Solutions
New Discussion юеВ

Re: deleting a particular line in a file

 
SOLVED
Go to solution
Henry Chua
Super Advisor

deleting a particular line in a file

Hi Guys,

I am writing a script to remove a particular line in a file but it doesnt seem to work:

#!/bin/ksh


dline=`echo "henry_25"`
jfile=`echo "list"`

echo "jfile = $jfile"
echo "dline = $dline"

sed '/\$dline/d' $jfile > file
~

It appears that my identifier are not recognisable.. but if i need these identifier how can i alter the 'sed' command to achieve this? ThankS

regards
Henry
3 REPLIES 3
Victor BERRIDGE
Honored Contributor

Re: deleting a particular line in a file

Hi Henry,

Woulnd a cat | grep -v "argument" >newfile do the job?


All the best
Victor
Victor Fridyev
Honored Contributor
Solution

Re: deleting a particular line in a file

Hi,

In this case you have to use " (double quote) instead of ' (single quote)

sed "/$dline/d" $jfile > file

HTH
Entities are not to be multiplied beyond necessity - RTFM
Henry Chua
Super Advisor

Re: deleting a particular line in a file

Victor suggestion is the answer i need! thank!!!