aboutsummaryrefslogtreecommitdiffstats
path: root/tools/splitat
blob: 4ca3ebd504646141fbafe808fcde591cbc931e5a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#!/bin/sh

set -e

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