You are not logged in.

#1 2005-09-27 07:53:23

rasat
Forum Fellow
From: Finland, working in Romania
Registered: 2002-12-27
Posts: 2,176
Website

How to edit with sed using a $var?

NamePkg="mousekeywin-0.2.wm.tar.gz"

Content of pkg.list

desktopewmh-0.1.wm.tar.gz
mousekeywin-0.2.wm.tar.gz
rcwminit-0.1.1.wm.tar.gz

How to remove line "mousekeywin-0.2.wm.tar.gz" with $NamePkg

Offline

#2 2005-09-27 10:28:44

T-Dawg
Forum Fellow
From: Wilmington, NC
Registered: 2005-01-29
Posts: 2,734

Re: How to edit with sed using a $var?

sed -e "s|$NamePkg||g" -i pkg.list

will delete it but leave an empty space in place

sed -e "/$NamePkg/d" -i pkg.list

will delete the line completely

Offline

#3 2005-09-27 17:58:59

rasat
Forum Fellow
From: Finland, working in Romania
Registered: 2002-12-27
Posts: 2,176
Website

Re: How to edit with sed using a $var?

Thanks

Offline

#4 2005-09-28 21:08:16

neri
Forum Fellow
From: Victoria, Canada
Registered: 2003-05-04
Posts: 552

Re: How to edit with sed using a $var?

rasat wrote:

Thanks

short explaination: these must be douple qoutes, otherwise the $NamePkg
isn't handled as a variable

-neri

Offline

Board footer

Powered by FluxBB