Replace deprecated 'egrep' commands with 'grep -E'. (#12306)

Co-authored-by: Sander Grendelman <sander.grendelman@axians.com>
This commit is contained in:
argusb 2025-12-22 14:27:41 +01:00 committed by GitHub
parent e0c13cc3ec
commit 5bf869c803
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
15 changed files with 19 additions and 19 deletions

View File

@ -140,7 +140,7 @@ public class KVMHostInfo {
long speed = 0L;
LOGGER.info("Fetching CPU speed from command \"lscpu\".");
try {
String command = "lscpu | grep -i 'Model name' | head -n 1 | egrep -o '[[:digit:]].[[:digit:]]+GHz' | sed 's/GHz//g'";
String command = "lscpu | grep -i 'Model name' | head -n 1 | grep -E -o '[[:digit:]].[[:digit:]]+GHz' | sed 's/GHz//g'";
if(isHostS390x()) {
command = "lscpu | grep 'CPU dynamic MHz' | cut -d ':' -f 2 | tr -d ' ' | awk '{printf \"%.1f\\n\", $1 / 1000}'";
}

View File

@ -17,7 +17,7 @@
# specific language governing permissions and limitations
# under the License.
#
for i in `xm list | awk '{ print $1 }' | egrep -v "Name|Domain-0"`
for i in `xm list | awk '{ print $1 }' | grep -E -v "Name|Domain-0"`
do
xm destroy $i
done

View File

@ -17,7 +17,7 @@
# specific language governing permissions and limitations
# under the License.
#
for i in `xm list | awk '{ print $1 }' | egrep -v "Name|Domain-0"`
for i in `xm list | awk '{ print $1 }' | grep -E -v "Name|Domain-0"`
do
xm destroy $i
done

View File

@ -100,7 +100,7 @@ while true; do
done
echo "$(date): Doing a recan to make sure we have proper current size locally"
for device in $(multipath -ll 3${WWID} | egrep '^ ' | awk '{print $2}'); do
for device in $(multipath -ll 3${WWID} | grep -E '^ ' | awk '{print $2}'); do
echo "1" > /sys/bus/scsi/drivers/sd/${device}/rescan;
done

View File

@ -51,7 +51,7 @@ systemctl is-active multipathd || systemctl restart multipathd || {
logger -t "CS_SCSI_VOL_RESIZE" "${WWID} resizing disk path at /dev/mapper/3${WWID} STARTING"
for device in $(multipath -ll 3${WWID} | egrep '^ ' | awk '{print $2}'); do
for device in $(multipath -ll 3${WWID} | grep -E '^ ' | awk '{print $2}'); do
echo "1" > /sys/bus/scsi/drivers/sd/${device}/rescan;
done

View File

@ -75,7 +75,7 @@ keytool -genkey -storepass "$KS_PASS" -keypass "$KS_PASS" -alias "$ALIAS" -keyal
# Generate CSR
$LOGGER_CMD "Generating CSR"
[ -f "$CSR_FILE" ] && rm -f "$CSR_FILE"
addresses=$(ip address | grep inet | awk '{print $2}' | sed 's/\/.*//g' | grep -v '^169.254.' | grep -v '^127.0.0.1' | egrep -v '^::1|^fe80' | grep -v '^::1' | sed 's/^/ip:/g' | tr '\r\n' ',')
addresses=$(ip address | grep inet | awk '{print $2}' | sed 's/\/.*//g' | grep -v '^169.254.' | grep -v '^127.0.0.1' | grep -E -v '^::1|^fe80' | grep -v '^::1' | sed 's/^/ip:/g' | tr '\r\n' ',')
$LOGGER_CMD "Found following SAN addresses to add to CSR: ${addresses}"
keytool -certreq -storepass "$KS_PASS" -alias "$ALIAS" -file "$CSR_FILE" -keystore "$KS_FILE" -ext san="$addresses" 2>&1 | $LOGGER_CMD
if [ $? -ne 0 ];then

View File

@ -112,7 +112,7 @@ find_port_group() {
}
# try to find the physical link to outside, only supports eth and em prefix now
trunk_port=`ovs-ofctl show $br | egrep "\((eth|em)[0-9]" | cut -d '(' -f 1|tr -d ' '`
trunk_port=`ovs-ofctl show $br | grep -E "\((eth|em)[0-9]" | cut -d '(' -f 1|tr -d ' '`
vm_port=$(find_port $vm_mac)
# craft the vlan headers. Adding 4096 as in hex, it must be of the form 0x1XXX

View File

@ -87,7 +87,7 @@ then
fi
# try to find the physical link to outside, only supports eth and em prefix now
trunk_port=`ovs-ofctl show $br | egrep "\((eth|em)[0-9]" | cut -d '(' -f 1|tr -d ' '`
trunk_port=`ovs-ofctl show $br | grep -E "\((eth|em)[0-9]" | cut -d '(' -f 1|tr -d ' '`
if [ "$op" == "add" ]
then

View File

@ -986,7 +986,7 @@ public class StatsCollector extends ManagerBase implements ComponentMethodInterc
double totalcpucap = 0;
if (StringUtils.isEmpty(cpucaps)) {
String totalCpus = Script.runSimpleBashScript("nproc --all| tr '\\n' \" \"");
String maxCpuSpeed = Script.runSimpleBashScript("lscpu | egrep 'CPU max MHz' | head -1 | cut -f 2 -d : | tr -d ' '| tr '\\n' \" \"");
String maxCpuSpeed = Script.runSimpleBashScript("lscpu | grep -E 'CPU max MHz' | head -1 | cut -f 2 -d : | tr -d ' '| tr '\\n' \" \"");
if (StringUtils.isNotEmpty(totalCpus) && StringUtils.isNotEmpty(maxCpuSpeed)) {
totalcpucap = Double.parseDouble(totalCpus) * Double.parseDouble(maxCpuSpeed);
}

View File

@ -41,7 +41,7 @@ isCifs() {
# ping dns server
echo ================================================
DNSSERVER=`egrep '^nameserver' /etc/resolv.conf | awk '{print $2}'| head -1`
DNSSERVER=`grep -E '^nameserver' /etc/resolv.conf | awk '{print $2}'| head -1`
echo "First DNS server is " $DNSSERVER
ping -c 2 $DNSSERVER
if [ $? -eq 0 ]

View File

@ -31,7 +31,7 @@ get_interface() {
for i in `seq 1 $(($timeout))`
do
#inf=$(ip route list ${1}/${2} | awk '{print $3}')
inf=$(ip addr show|egrep '^ *inet'|grep ${1}/${2} |grep brd|awk -- '{ print $NF; }')
inf=$(ip addr show|grep -E '^ *inet'|grep ${1}/${2} |grep brd|awk -- '{ print $NF; }')
if [ ! -z $inf ]; then
echo $inf
break

View File

@ -210,9 +210,9 @@ class TestMultiplePublicIpSubnets(cloudstackTestCase):
self.logger.debug("Skip as redundant_state is %s" % redundant_state)
return
elif redundant_state == "PRIMARY":
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state DOWN" |wc -l' % publicNics
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state DOWN" |wc -l' % publicNics
elif redundant_state == "BACKUP":
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state UP" |wc -l' % publicNics
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state UP" |wc -l' % publicNics
result = get_process_status(
host.ipaddress,
host.port,

View File

@ -210,9 +210,9 @@ class TestMultiplePublicIpSubnets(cloudstackTestCase):
self.logger.debug("Skip as redundant_state is %s" % redundant_state)
return
elif redundant_state == "PRIMARY":
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state DOWN" |wc -l' % publicNics
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state DOWN" |wc -l' % publicNics
elif redundant_state == "BACKUP":
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state UP" |wc -l' % publicNics
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state UP" |wc -l' % publicNics
result = get_process_status(
host.ipaddress,
host.port,

View File

@ -214,9 +214,9 @@ class TestMultiplePublicIpSubnets(cloudstackTestCase):
self.logger.debug("Skip as redundant_state is %s" % redundant_state)
return
elif redundant_state == "PRIMARY":
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state DOWN" |wc -l' % publicNics
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state DOWN" |wc -l' % publicNics
elif redundant_state == "BACKUP":
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state UP" |wc -l' % publicNics
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state UP" |wc -l' % publicNics
result = get_process_status(
host.ipaddress,
host.port,

View File

@ -214,9 +214,9 @@ class TestMultiplePublicIpSubnets(cloudstackTestCase):
self.logger.debug("Skip as redundant_state is %s" % redundant_state)
return
elif redundant_state == "PRIMARY":
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state DOWN" |wc -l' % publicNics
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state DOWN" |wc -l' % publicNics
elif redundant_state == "BACKUP":
command = 'ip link show |grep BROADCAST | egrep "%s" |grep "state UP" |wc -l' % publicNics
command = 'ip link show |grep BROADCAST | grep -E "%s" |grep "state UP" |wc -l' % publicNics
result = get_process_status(
host.ipaddress,
host.port,