summaryrefslogtreecommitdiff
path: root/nonewlines.sh
blob: e765d64fae8d65690d2dfc3b7f12fc69f2b6543b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
#!/bin/sh
usage="Usage: $0 dir

Concatenates all .txt files in a directory together and removes all
line breaks, saving the result to dirname.txt"

test $# -ne 1 && echo "$usage" && exit 1

d=`dirname "$1"`
cat "$1"/*txt | tr -d '\n' > "${d}.txt"

echo "Saved all text, with no newlines, to ${d}.txt"