kernelnewbies.kernelnewbies.org archive mirror
 help / color / mirror / Atom feed
From: Valdis.Kletnieks@vt.edu (Valdis.Kletnieks at vt.edu)
To: kernelnewbies@lists.kernelnewbies.org
Subject: Deleting a line from a file
Date: Thu, 15 May 2014 04:06:49 -0400	[thread overview]
Message-ID: <82500.1400141209@turing-police.cc.vt.edu> (raw)
In-Reply-To: Your message of "Thu, 15 May 2014 09:55:52 +0200." <1400140552.18277.48.camel@thorin>

On Thu, 15 May 2014 09:55:52 +0200, Bernd Petrovitsch said:

> sed -i '/\/opt\/new1/d' file_entries.txt
>
> should do it.
> Just for the match, we do not need, the tailing ".*$" (because it
> matches always).

Actually, you want to use /^\/opt\/new1[ \t]/d because otherwise it will
also delete lines that contain   /usr/opt/new1   and /opt/new12.

So you want a pattern that matches ^ anchor at start, the actual
/opt/new1 pathname, and then either a blank or tab whitespace....

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 848 bytes
Desc: not available
Url : http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20140515/2137e5e3/attachment.bin 

  reply	other threads:[~2014-05-15  8:06 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-05-14 14:28 Deleting a line from a file Saket Sinha
2014-05-14 14:34 ` Bernd Petrovitsch
2014-05-14 15:18   ` Valdis.Kletnieks at vt.edu
2014-05-15  7:55     ` Bernd Petrovitsch
2014-05-15  8:06       ` Valdis.Kletnieks at vt.edu [this message]
2014-05-14 15:57   ` Saket Sinha
2014-05-14 16:14     ` Valdis.Kletnieks at vt.edu
2014-05-14 16:43       ` Saket Sinha
2014-05-14 17:51         ` Valdis.Kletnieks at vt.edu
2014-05-15  7:53     ` Bernd Petrovitsch

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=82500.1400141209@turing-police.cc.vt.edu \
    --to=valdis.kletnieks@vt.edu \
    --cc=kernelnewbies@lists.kernelnewbies.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).