Question: Replace bash onliner with sift / golang
pwFoo opened this issue · 2 comments
pwFoo commented
Could you help me to replace that bash oneliner with golang / sift?
To HW detection and load needed modules during boot / initialization.
grep -h MODALIAS /sys/bus/*/devices/*/uevent | cut -d= -f2 | xargs /sbin/modprobe -abq 2> /dev/null
I'm new with golang and search a replacement
The modprobe part can be ignored.
stonedbovines commented
sift --no-filename --no-color MODALIAS /sys/bus/*/devices/*/uevent
is the equivalent extraction
pwFoo commented
Thank's! Seems to be easy to include the cut command in sift.
sift '(MODALIAS=)(.*)' --no-filename --no-color --replace '$2' /sys/bus/*/devices/*/uevent
But how to remove empty lines?