shell - How to create multiple files of the same size from a variable? -
i have shell script variable create output file follows
variable >> file.txt result: file.txt 20 kilobytes then, have split output file in several of same size using split instruction
result:
file01.txt 10 kilobytes file02.txt 10 kilobytes my question is: there way apply equivalent of split instruction while creating output file? expected output:
variable >> file.txt / / adding here code needed split result:
file01.txt 10 kilobytes file02.txt 10 kilobytes
an example,
echo $var | split -b 10240 you can specify output file prefix this:
echo $var | split -b 10240 - dir1/mysplits which produces filenames dir1/mysplitsaa, dir1/mysplitsab, dir1/mysplitsac, ... can rename these files after split of course.
Comments
Post a Comment