Use awk instead of the non-portable "~" sed command.

This commit is contained in:
Andrew Wood
2026-04-20 22:55:24 +01:00
parent 1d28da18ce
commit c0e530eefd
+2 -2
View File
@@ -8,7 +8,7 @@ test "${SKIP_ALL_TESTS}" = "1" && exit 77
true "${testSubject:?not set - call this from 'make check'}"
true "${workFile1:?not set - call this from 'make check'}"
seq 1 100 | "${testSubject}" -M in -f -l -b -- sed '1~2d' >/dev/null 2>"${workFile1}"
seq 1 100 | "${testSubject}" -M in -f -l -b -- awk 'FNR%2==0{print}' >/dev/null 2>"${workFile1}"
counterValue=$(tr '\r' '\n' < "${workFile1}" | awk '/[0-9]/{print int($1)}' | sed -n '$p')
if ! test "${counterValue}" = "100"; then
@@ -16,7 +16,7 @@ if ! test "${counterValue}" = "100"; then
exit 1
fi
seq 1 100 | "${testSubject}" -M out -f -l -b -- sed '1~2d' >/dev/null 2>"${workFile1}"
seq 1 100 | "${testSubject}" -M out -f -l -b -- awk 'FNR%2==0{print}' >/dev/null 2>"${workFile1}"
counterValue=$(tr '\r' '\n' < "${workFile1}" | awk '/[0-9]/{print int($1)}' | sed -n '$p')
if ! test "${counterValue}" = "50"; then