diff options
author | Nick White <git@njw.name> | 2019-03-26 18:04:44 +0000 |
---|---|---|
committer | Nick White <git@njw.name> | 2019-03-26 18:04:44 +0000 |
commit | a2648f87a504395567c5f0aa24e11cf46cb8baee (patch) | |
tree | 0119e0d6447033c8651c4382fff45e5b13fedef7 /nonewlines.sh | |
parent | 7f3b848dce01a7543dc584c0f42bb80859025fa9 (diff) |
Add nonewlines script
Diffstat (limited to 'nonewlines.sh')
-rw-r--r-- | nonewlines.sh | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/nonewlines.sh b/nonewlines.sh new file mode 100644 index 0000000..3b5af27 --- /dev/null +++ b/nonewlines.sh @@ -0,0 +1,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" |