Splitting a file into multiple files
In this we will attempt to split a file into multiple files (4 files in this case)
Firstly, we are getting total number of lines in actual file using "wc" command
total_lines=$(wc -l < tables.lst)
lines_per_file=$(( (total_lines + 3) / 4 )) # Add 3 to handle any remainder in the division
split -l $lines_per_file tables.lst output_prefix_
No comments:
Post a Comment