sift icon indicating copy to clipboard operation
sift copied to clipboard

Question: Replace bash onliner with sift / golang

Open pwFoo opened this issue 6 years ago • 2 comments

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.

pwFoo avatar Sep 08 '18 09:09 pwFoo

sift --no-filename --no-color MODALIAS /sys/bus/*/devices/*/uevent is the equivalent extraction

stonedbovines avatar Sep 08 '18 10:09 stonedbovines

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?

pwFoo avatar Sep 08 '18 11:09 pwFoo