[Spce-user] Merge CDR

Daniel Tiefnig dtiefnig at sipwise.com
Wed May 9 14:16:39 EDT 2012

On 05/09/2012 07:43 PM, Francisco Hidalgo wrote:
> El 09/05/2012 17:34, Matthew Ogden escribió:
>> I’m not sure of what the linux equivalent is, but if the files are
>> on windows, you can say “copy *.cdr singlefile.cdr” and it will 
>> merge all the lines into a single file, the only issue is you will
>> need to remove the headers and checksum, but that is very to 
>> ignore.
> Many thanks, it's any way to remove the first cell and the last 
> cell?


using Perl, you can do all three in one step:

perl -ne'next if /^\d+,\d+$/; next if /^[^,]+$/; \
  s/^[^,]+,(.+),[^,]+$/$1\n/;print' *.cdr >merged.cdr

Line break added for mail transport. You may also wish to use "\r\n"
instead of "\n" in the substitution while on MS Windows.

Or, a bit shorter, but *slightly* less readable:

perl -pe's/^(\d+,)?[^,]+$//;s/^[^,]+,//;s/,[^,]+$/\n/' *.cdr >merged.cdr

(Golf, anyone? :o)


More information about the Spce-user mailing list