Answer the question
In order to leave comments, you need to log in
In script #!/bin/sh to variable value from execution (grep|awk|sed)
(I don't understand something)
In the script, I need to assign a value to a variable based on the result of executing (any tool) grep|awk|sed, i.e. design:
x=$(lsusb | grep ...)
Answer the question
In order to leave comments, you need to log in
grep has a parameter to output only a substring that matches the regular expression
egrep -o [...]
egrep --only-matching [...]
x=$(lsusb | egrep -o ...)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question