🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: alt.privacy.anon-server
Article #305787

Re: Using 'sed' to delete a line from a file (Was: Linux Command-Line Editors Vulnerable to High-Severity Bug)

#305787
From: Grant Taylor
Date: Thu, 20 Jun 2019 18:17
17 lines
1961 bytes
On 6/20/19 6:32 AM, Kenny McCormack wrote:
> Note that this problem gets more tricky if you want to support deleting 
> more than one line in a single invocation.  I actually figured out 
> a way to do this with sed - by invoking sed twice

You can do it with a single invocation of sed:

    sed -i.old '418d;327d;125d' ~/.ssh/known_hosts

You don't /have/ to do the lower lines first.  But you do need to adjust 
the line numbers of lower lines if you delete earlier lines first.



-- 
Grant. . . .
unix || die
Technical Details
Message-ID: <qegikc$qgn$1@tncsrv09.home.tnetconsulting.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
References: <qe8q2c$9f8$1@news.mixmin.net> <5vqhge9nua902qvknjh7ocfjg2g6qbv0qi@4ax.com> <qef78p$762$2@gonzo.revmaps.no-ip.org> <pgtmge5haptnvn6tu35fapmssdrnge92bo@4ax.com> <qefucv$eri$1@news.xmission.com>

Show Full Headers
Complete Article Headers
Message-ID: <qegikc$qgn$1@tncsrv09.home.tnetconsulting.net>
Subject: Re: Using 'sed' to delete a line from a file (Was: Linux Command-Line Editors Vulnerable to High-Severity Bug)
Date: Thu, 20 Jun 2019 12:17:10 -0600
From: Grant Taylor <gtaylor@tnetconsulting.net>
References: <qe8q2c$9f8$1@news.mixmin.net> <5vqhge9nua902qvknjh7ocfjg2g6qbv0qi@4ax.com> <qef78p$762$2@gonzo.revmaps.no-ip.org> <pgtmge5haptnvn6tu35fapmssdrnge92bo@4ax.com> <qefucv$eri$1@news.xmission.com>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!apf1.newsdeef.eu!not-for-mail
Newsgroups: alt.privacy.anon-server,alt.os.linux,comp.os.linux.misc,comp.os.linux.advocacy
Organization: TNet Consulting
Lines: 17
NNTP-Posting-Host: alpha.home.tnetconsulting.net
Mime-Version: 1.0
Content-Type: text/plain; charset=utf-8; format=flowed
Content-Transfer-Encoding: 7bit
X-Trace: tncsrv09.home.tnetconsulting.net 1561054668 27159 198.18.18.251 (20 Jun 2019 18:17:48 GMT)
X-Complaints-To: newsmaster@tnetconsulting.net
NNTP-Posting-Date: Thu, 20 Jun 2019 18:17:48 +0000 (UTC)
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101
 Thunderbird/60.6.1
In-Reply-To: <qefucv$eri$1@news.xmission.com>
Content-Language: en-US