diff options
| author | Jan T <jan@jantuomi.fi> | 2025-11-13 11:31:30 +0000 |
|---|---|---|
| committer | Jan Tuomi <jan@jantuomi.fi> | 2025-11-13 13:34:38 +0200 |
| commit | 3df80b5afbebbf3af63b49fe98a3faecd2b68439 (patch) | |
| tree | 3db37a25de23b7a6b21b3df261b84dc1359c1555 /tools/splitat | |
Initial commit
Diffstat (limited to 'tools/splitat')
| -rwxr-xr-x | tools/splitat | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/splitat b/tools/splitat new file mode 100755 index 0000000..d41521e --- /dev/null +++ b/tools/splitat @@ -0,0 +1,14 @@ +#!/bin/sh + +if [ "$#" -ne 1 ]; then + echo "Usage: $0 <separator>" + echo "" + echo "Split the stdin into lines, splitting at the given separator character." + exit 1 +fi + +while IFS=$'\n' read -r line; do + for part in $(echo "$line" | tr "$1" '\n'); do + echo "$part" + done +done |
