Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question: Replace bash onliner with sift / golang #100

Open
pwFoo opened this issue Sep 8, 2018 · 2 comments
Open

Question: Replace bash onliner with sift / golang #100

pwFoo opened this issue Sep 8, 2018 · 2 comments

Comments

@pwFoo
Copy link

pwFoo commented Sep 8, 2018

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
Copy link

stonedbovines commented Sep 8, 2018

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

@pwFoo
Copy link
Author

pwFoo commented Sep 8, 2018

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants