bash - Use tr to remove line breaks in multiple files? -
i have set of several hundred .txt files analyzing (ngram analysis using nsp), , need remove line breaks each file. can 1 @ time using tr:
$ tr -d "\n\r" < input1.txt > output1.txt
how can entire directory of files @ once?
this add together -out before .txt. haven't specified filenames like, other .txt, don't have input files named foo-out.txt, etc.
for f in *.txt tr -d "\n\r" < $f > $(basename $f .txt)-out.txt done
bash for-loop newline tr file-manipulation
No comments:
Post a Comment