Answer the question
In order to leave comments, you need to log in
How to remove everything up to a character within a string?
Hello!
There is a file file.txt with the content:
1_0_0.jpg 2_0_1.jpg 3_0_8.jpg
6_0_4.jpg 7_0_5.jpg 8_0_9.jpg
how to make sure that everything from the symbol _ to .jpg inclusive is deleted from the line so that
1 2 3
6 7 8 remains
Answer the question
In order to leave comments, you need to log in
str="1_0_0.jpg 2_0_1.jpg 3_0_8.jpg
6_0_4.jpg 7_0_5.jpg 8_0_9.jpg"
echo "$str" | sed -r 's/([0-9]+)[^\.]+\.jpg/\1/g'
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question