diff mbox series

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

Message ID 20220222120718.17141-1-pmenzel@molgen.mpg.de (mailing list archive)
State New
Headers show
Series [1/2] torture: Select line in sed and replace grep | expand

Commit Message

Paul Menzel Feb. 22, 2022, 12:07 p.m. UTC
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@molgen.mpg.de>
---
 tools/testing/selftests/rcutorture/bin/functions.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
diff mbox series

Patch

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