V
V
Vadim2021-07-15 16:43:40
linux
Vadim, 2021-07-15 16:43:40

How to remove an unknown substring within strings, in a file?

Hello everyone,

there are different lines in the text file, including lines like:

SF:./var/src/routes/okta/logout.jsx
SF:./opt/src/routes/new/exit.jsx

you need to delete the text before src/ and before the colon to get

SF:.src/routes/okta/logout.jsx
SF:.src/routes/new/exit.jsx

Good luck,
Vadim

Answer the question

In order to leave comments, you need to log in

1 answer(s)
X
xibir, 2021-07-15
@Viji

sed -ri '[email protected]^(SF:).+(src/.+)@\1\[email protected]' file.txt

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question