Skip to content

Commit 8021272

Browse files
Simplify sed command for swapping numbers and names
1 parent a9cb0f8 commit 8021272

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

individual-shell-tools/sed/script-05.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ set -euo pipefail
66
# If a line starts with a number and a space, make the line instead end with a space and the number.
77
# So line 6 which currently reads "37 Alisha" should instead read "Alisha 37".
88
# The output should contain 11 lines.
9-
sed -E "s/^[[:space:]]*([0-9]+)[[:space:]]+(.*)$/\2 \1/" input.txt
9+
sed -E "s/^ *([0-9]+) +(.*)$/\2 \1/" input.txt

0 commit comments

Comments
 (0)