I have these three files:
file.txt.7z = 5.4GB
file-1.txt.7z = 251M
file-2.txt.7z = 7.7M
And they are the only files in a directory:
$ tree
.
├── file.txt.7z
├── file-1.txt.7z
└── file-2.txt.7z
I want to
- unzip the files
- combine them into one file
- split that combined file into files of 500,000 lines
- have as a result a number of files with a ".txt" extention
Right now I am achieving it this way:
p7zip -d "*.txt.7z"
cat file-1.txt >> file.txt
rm file-1.txt
cat file-2.txt >> file.txt
rm file-2.txt
split -l 500000 file.txt
for f in *; do mv "$f" "$f.txt"; done
How could I achieve this in a more elegant way?