From 65e1c914a2d0257634572f3f0f762c7cf3e0df65 Mon Sep 17 00:00:00 2001 From: Andrej Valek Date: Tue, 1 Mar 2022 17:46:54 +0100 Subject: [PATCH] tools: replace sed with awk to get exactly the last element Signed-off-by: Andrej Valek --- tools/wipe-linux.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/wipe-linux.sh b/tools/wipe-linux.sh index 507f84a3..76637a15 100755 --- a/tools/wipe-linux.sh +++ b/tools/wipe-linux.sh @@ -1,10 +1,10 @@ #!/bin/sh set -e -diskutil list | grep Apple_APFS | grep '\b2\.5 GB' | sed 's/.* //g' | while read i; do +diskutil list | awk '/Apple_APFS.* 2\.5 GB/{print $NF}' | while read i; do diskutil apfs deleteContainer "$i" done -diskutil list /dev/disk0 | grep -Ei 'asahi|linux|EFI' | sed 's/.* //g' | while read i; do +diskutil list /dev/disk0 | awk 'tolower($0) ~ /asahi|linux|EFI/{print $NF}' | while read i; do diskutil eraseVolume free free "$i" done