I've 672 files in local directory, filenames are like: boutique-*_20160116hh0000.csv
, general-tgbt_1_20160116hh0000.csv
, where hh - hours' number and (for instance, boutique-a13_15_20160116060000.csv
, boutique-a16_18_20160116070000.csv
, boutique-a05_7_20160116190000.csv
and so on).
I run the following command in bash:
(for i in `ls -1 | sort`; do cat $i | while read line; do echo "${i%%_2016*}," $line; done ; done;) > c.csv
And it leads to infinite loop, file c.csv
grows in size.
Whats the reason?
I believe that my c.csv
file is also falling into result of
`ls -1 | sort`
But is this behaviour correct?
After getting the first comment I try another test - keep only 4 files instead of 672 (boutique-a05_7_20160116220000.csv, boutique-a16_18_20160116020000.csv, general-tgbt_1_20160116170000.csv, wago-pfc-750-815_99_20160116020000.csv) and my command works fine.
Thanks
( commands here not run until at least ) > output_here_is_opened