GREP behavior changed?


Recommended Posts

Hello all,

I'm really just posting this because I want to see if anyone else has experienced this behavior with grep in unraid. I don't think this is an issue with unraid per se. I have a bash shell script that I have been running for several years without issue. The day after I upgraded to 6.7 the script broke and I had no idea why. After a couple of hours of trouble shooting I discovered the line below, which the output is supposed to be saved to a variable, wasn't grabbing anything. Note: this is not the full line of code...just the part the demonstrates the behavior.

virsh domblklist "domain" --details | grep ^file

If you run this line at the command line in unraid, assuming you are running virtual machines, and replace "domain" with the name of a VM, it should return a line of information on the VM...or so it used to. When I run this now it returns nothing, which caused the variables to never get populated which caused the script to fail. If I drop the caret (regex), it returns what is expected. It appears the grep version changed in 6.7, but I can't find any information concerning any changes to grep that would have caused this behavior. So, I'm curious if anyone else has run across this behavior and maybe more importantly, educate me. It's just one of those little mysteries that causes me to slowly lose my sanity! Thanx!

Edited by _vern_
Link to comment

Thank you...I have figured out what has changed. The virsh domblklist --details command output has changed...the line of data now begins with a space so the pattern "^file" no longer matches it. Mystery solved. Thank you for the reply!

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.