11

Bash scripting and large file

view full story
linux-howto

http://unix.stackexchange.com – I have a strange issue with large files and bash. This is the context: I have a large file: 75G and 400,000,000+ lines (it is a log file, my bad, I let it grow). The first 10 chars of each line is a time stamps in the format YYYY-MM-DD. I want to split that file: one file per day. I tried it with the following script that did not work: while read line; do new_file=${line:0:4}-${line:5:2}-${line:8:2}_file.log echo "$line" >> $new_file done < file.log After debugging, I found the problem in the new_file variable. This script: while read line; do new_file=${line:0:4}-${li (HowTos)