Categories
Preg match in bash like in php?
Hello, how to get this in a bash script? There is a string Str = lalchlch login - 79991234567, password durhfh4fj At the output in variables Login = 79991234567 Pass = durhfh4fj
Answer the question
In order to leave comments, you need to log in
It can be like this:
Str="лялчлч логин - 79991234567, пароль durhfh4fj" Login=`echo "$Str" | grep -Po "логин - \K[0-9]+"` Pass=`echo "$Str" | grep -Po "пароль \K.+"` echo "Login=$Login" echo "Pass=$Pass"
Didn't find what you were looking for?
Ask a Question
731 491 924 answers to any question