A
A
Antomas2016-01-26 21:02:52
bash
Antomas, 2016-01-26 21:02:52

How to cut text using bash?

the text that contains the string https:\/\/scontent1.kurazh.com\\/6_58_7865_n.jpg , how to extract it and write it to the var variable (for example). Number of lines, file size unknown. The script finds the word https and copies until the word ends with .jpg

, tried to mess with sed, nothing happened. Help me please.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Saboteur, 2016-01-26
@Antomas

It's not entirely clear what exactly you need?
All URLs ending with .jpg?
It is possible through grep with a regular expression. Just clarify the problem with an example, or try it right away like this:
var=`grep -P -o "https.*\.jpg" text.txt`

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question