As we process our csv data, we generate a lot of output files with 30 000 lines in each one of them. They all have the same columns/fields. They are all also in csv format and we put them into the same folder on the Linux server. The files are uniquely named using a combination of date, time and numeric digits. See below.
AB_20151127_120000_0_SEGMENT_FINAL.csv
AB_20151127_120000_1_SEGMENT_FINAL.csv
AB_20151127_120000_2_SEGMENT_FINAL.csv
AB_20151127_120000_3_SEGMENT_FINAL.csv
.
.
.
AB_20151127_120000_599_SEGMENT_FINAL.csv
So now we need to merge/join all of them into one big file called:
AB_20151127_120000_SEGMENT_FINAL.csv (note the missing numeric digits from the merged file)
I tried awk as below but it is not working. Please tell me what I did wrong.
awk '"AB_20151127_120000_" NR-1 "_SEGMENT_FINAL.csv"' > AB_20151127_120000_SEGMENT_FINAL.csv
cat AB_20151127_120000_{1..599}_SEGMENT_FINAL.csv > AB_20151127_120000_SEGMENT_FINAL.csv? – muru Dec 09 '15 at 10:48AB_20151127_120000_*_SEGMENT_FINAL.csv, the files will be in lexicographic order (1, 11, 12, ..., 199, 2, 21, ...). – muru Dec 09 '15 at 10:57599with$(ls AB_20151127_120000_*.csv | wc -l)– Ralph Rönnquist Dec 09 '15 at 11:14"AB_20151127_120000_" NR-1 "_SEGMENT_FINAL.csv". Realy should be justawk AB_20151127_120000_*_SEGMENT_FINAL.csv '1' > outputFile.cvs(note 1 evaluates to true on each line, so it always prints). Butcatis the way to go, however. You are not doing any special processing with the files, only creating one big file – Sergiy Kolodyazhnyy Dec 09 '15 at 12:12catis the way to go in this case. OP isn't doing any special processing with the files, just concatenating – Sergiy Kolodyazhnyy Dec 09 '15 at 12:19