[PATCH 1/2] torture: Select line in sed and replace grep

From: Paul Menzel
Date: Tue Feb 22 2022 - 07:07:45 EST


sed’s switch `-n` (`--silent`) suppresses the automatic printing of
the pattern space, therefore, allowing to replace grep by only
printing the current pattern space using the command `p`.

Signed-off-by: Paul Menzel <pmenzel@xxxxxxxxxxxxx>
---
tools/testing/selftests/rcutorture/bin/functions.sh | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/testing/selftests/rcutorture/bin/functions.sh b/tools/testing/selftests/rcutorture/bin/functions.sh
index c35ba24f994c..5cff520955e6 100644
--- a/tools/testing/selftests/rcutorture/bin/functions.sh
+++ b/tools/testing/selftests/rcutorture/bin/functions.sh
@@ -301,7 +301,7 @@ specify_qemu_cpus () {
echo $2 -smp $3
;;
qemu-system-ppc64)
- nt="`lscpu | grep '^NUMA node0' | sed -e 's/^[^,]*,\([0-9]*\),.*$/\1/'`"
+ nt="`lscpu | sed -n -e '/^NUMA node0/s/^[^,]*,\([0-9]*\),.*$/\1/p'`"
echo $2 -smp cores=`expr \( $3 + $nt - 1 \) / $nt`,threads=$nt
;;
esac
--
2.35.1