I have a variable with the contents “eth0 eth1 bond0”, is there a way using sed or a similar tool to move anything matching bond.* to the beginning of the line?
I have a variable with the contents eth0 eth1 bond0, is there a way
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Using nothing but Bash:
Edit:
This version handles multiple occurrences of “bond” anywhere within the string:
Output:
Edit 2:
Here is a
sedversion that is specific to the string “bond” followed by one or more digits rather than allowing any word that begins with “b”: