Q
Q
qvb2019-10-12 15:30:18
bash
qvb, 2019-10-12 15:30:18

Sed search for a string containing "text" but not containing "."?

Hello,
There is a book.txt file containing records of the type:
text
word.text
The task is to delete only the line in the file that contains text, not text and word.text.
Can sed handle this without GNU? This example removes text and word.text.
sed -i "/text =/d" /book.txt

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitsliputsli, 2019-10-12
@qvb

Probably so:
sed -i "/^text$/d" /book.txt

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question