Skip to content

Commit 5bf869c

Browse files
argusbSander Grendelman
andauthored
Replace deprecated 'egrep' commands with 'grep -E'. (#12306)
Co-authored-by: Sander Grendelman <sander.grendelman@axians.com>
1 parent e0c13cc commit 5bf869c

File tree

15 files changed

+19
-19
lines changed

15 files changed

+19
-19
lines changed

plugins/hypervisors/kvm/src/main/java/org/apache/cloudstack/utils/linux/KVMHostInfo.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ private static long getCpuSpeedFromCommandLscpu() {
140140
long speed = 0L;
141141
LOGGER.info("Fetching CPU speed from command \"lscpu\".");
142142
try {
143-
String command = "lscpu | grep -i 'Model name' | head -n 1 | egrep -o '[[:digit:]].[[:digit:]]+GHz' | sed 's/GHz//g'";
143+
String command = "lscpu | grep -i 'Model name' | head -n 1 | grep -E -o '[[:digit:]].[[:digit:]]+GHz' | sed 's/GHz//g'";
144144
if(isHostS390x()) {
145145
command = "lscpu | grep 'CPU dynamic MHz' | cut -d ':' -f 2 | tr -d ' ' | awk '{printf \"%.1f\\n\", $1 / 1000}'";
146146
}

plugins/hypervisors/ovm3/src/test/resources/scripts/clean_primary.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# specific language governing permissions and limitations
1818
# under the License.
1919
#
20-
for i in `xm list | awk '{ print $1 }' | egrep -v "Name|Domain-0"`
20+
for i in `xm list | awk '{ print $1 }' | grep -E -v "Name|Domain-0"`
2121
do
2222
xm destroy $i
2323
done

plugins/hypervisors/ovm3/src/test/resources/scripts/clean_secondary.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
# specific language governing permissions and limitations
1818
# under the License.
1919
#
20-
for i in `xm list | awk '{ print $1 }' | egrep -v "Name|Domain-0"`
20+
for i in `xm list | awk '{ print $1 }' | grep -E -v "Name|Domain-0"`
2121
do
2222
xm destroy $i
2323
done

scripts/storage/multipath/connectVolume.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ while true; do
100100
done
101101

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

scripts/storage/multipath/resizeVolume.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ systemctl is-active multipathd || systemctl restart multipathd || {
5151

5252
logger -t "CS_SCSI_VOL_RESIZE" "${WWID} resizing disk path at /dev/mapper/3${WWID} STARTING"
5353

54-
for device in $(multipath -ll 3${WWID} | egrep '^ ' | awk '{print $2}'); do
54+
for device in $(multipath -ll 3${WWID} | grep -E '^ ' | awk '{print $2}'); do
5555
echo "1" > /sys/bus/scsi/drivers/sd/${device}/rescan;
5656
done
5757

scripts/util/keystore-setup

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@ keytool -genkey -storepass "$KS_PASS" -keypass "$KS_PASS" -alias "$ALIAS" -keyal
7575
# Generate CSR
7676
$LOGGER_CMD "Generating CSR"
7777
[ -f "$CSR_FILE" ] && rm -f "$CSR_FILE"
78-
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' ',')
78+
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' ',')
7979
$LOGGER_CMD "Found following SAN addresses to add to CSR: ${addresses}"
8080
keytool -certreq -storepass "$KS_PASS" -alias "$ALIAS" -file "$CSR_FILE" -keystore "$KS_FILE" -ext san="$addresses" 2>&1 | $LOGGER_CMD
8181
if [ $? -ne 0 ];then

scripts/vm/network/ovs-pvlan-kvm-vm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ find_port_group() {
112112
}
113113

114114
# try to find the physical link to outside, only supports eth and em prefix now
115-
trunk_port=`ovs-ofctl show $br | egrep "\((eth|em)[0-9]" | cut -d '(' -f 1|tr -d ' '`
115+
trunk_port=`ovs-ofctl show $br | grep -E "\((eth|em)[0-9]" | cut -d '(' -f 1|tr -d ' '`
116116
vm_port=$(find_port $vm_mac)
117117

118118
# craft the vlan headers. Adding 4096 as in hex, it must be of the form 0x1XXX

scripts/vm/network/ovs-pvlan-vm.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ then
8787
fi
8888

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

9292
if [ "$op" == "add" ]
9393
then

server/src/main/java/com/cloud/server/StatsCollector.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -986,7 +986,7 @@ private double getSystemCpuCyclesTotal() {
986986
double totalcpucap = 0;
987987
if (StringUtils.isEmpty(cpucaps)) {
988988
String totalCpus = Script.runSimpleBashScript("nproc --all| tr '\\n' \" \"");
989-
String maxCpuSpeed = Script.runSimpleBashScript("lscpu | egrep 'CPU max MHz' | head -1 | cut -f 2 -d : | tr -d ' '| tr '\\n' \" \"");
989+
String maxCpuSpeed = Script.runSimpleBashScript("lscpu | grep -E 'CPU max MHz' | head -1 | cut -f 2 -d : | tr -d ' '| tr '\\n' \" \"");
990990
if (StringUtils.isNotEmpty(totalCpus) && StringUtils.isNotEmpty(maxCpuSpeed)) {
991991
totalcpucap = Double.parseDouble(totalCpus) * Double.parseDouble(maxCpuSpeed);
992992
}

systemvm/agent/scripts/ssvm-check.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ isCifs() {
4141

4242
# ping dns server
4343
echo ================================================
44-
DNSSERVER=`egrep '^nameserver' /etc/resolv.conf | awk '{print $2}'| head -1`
44+
DNSSERVER=`grep -E '^nameserver' /etc/resolv.conf | awk '{print $2}'| head -1`
4545
echo "First DNS server is " $DNSSERVER
4646
ping -c 2 $DNSSERVER
4747
if [ $? -eq 0 ]

0 commit comments

Comments
 (0)