diff -ur scripts/duration scripts/duration
|
|
|
137 | 137 | # 5) start with one or more chars, then '.', then three chars, then one or more chars (for 'evt' etc.) |
138 | 138 | case5='/^.+\.[^.]{3}\.([^.-]*)+(-shifted)?$/' |
139 | 139 | |
140 | | extension=$(basename $filename | sed -r -e "$case1 s//\1/;$case2 s//\1/;$case3 s//\1/;$case4 s//\1/;$case5 s//\1/") |
| 140 | extension=$(basename $filename | sed -E -e "$case1 s//\1/;$case2 s//\1/;$case3 s//\1/;$case4 s//\1/;$case5 s//\1/") |
141 | 141 | |
142 | 142 | # Compute duration in ms |
143 | 143 | case $extension in |
diff -ur scripts/ndm_functions scripts/ndm_functions
|
|
|
78 | 78 | # Print error message |
79 | 79 | echo_error() |
80 | 80 | { |
81 | | indent=$(echo "$1"|sed -r 's/^([ ]*).*/\1/') |
| 81 | indent=$(echo "$1"|sed -E 's/^([ ]*).*/\1/') |
82 | 82 | message=$(echo "$1"|sed 's/^ *//g') |
83 | 83 | |
84 | 84 | echo -en "$RED" >&2 |
… |
… |
|
89 | 89 | # Print warning message |
90 | 90 | echo_warning() |
91 | 91 | { |
92 | | indent=$(echo "$1"|sed -r 's/^([ ]*).*/\1/') |
| 92 | indent=$(echo "$1"|sed -E 's/^([ ]*).*/\1/') |
93 | 93 | message=$(echo "$1"|sed 's/^ *//g') |
94 | 94 | |
95 | 95 | echo -en "$BLUE" >&2 |
… |
… |
|
111 | 111 | # break |
112 | 112 | # fi |
113 | 113 | # done |
114 | | # indent=$(echo "$1"|sed -r 's/^([ ]*).*/\1/') |
| 114 | # indent=$(echo "$1"|sed -E 's/^([ ]*).*/\1/') |
115 | 115 | # message=$(echo "$1"|sed 's/^ *//g') |
116 | 116 | # |
117 | 117 | echo $* |
… |
… |
|
469 | 469 | # Start with the 'easy' ones |
470 | 470 | date=$(filename_date $dirname) |
471 | 471 | [ -z "$date" ] && return |
472 | | prefix=$(echo $dirname|sed -r '/(.*)-'$date'.*/!d;s//\1/') |
| 472 | prefix=$(echo $dirname|sed -E '/(.*)-'$date'.*/!d;s//\1/') |
473 | 473 | |
474 | 474 | # Deal with the 'hard' end of the filename |
475 | 475 | description=${dirname#$prefix-$date} |
476 | 476 | if [ -z "$suffix" ] && ! $no_suffix |
477 | 477 | then |
478 | | suffix=$(echo $description|sed -r '/.*-(.*)/!d;s//\1/') |
| 478 | suffix=$(echo $description|sed -E '/.*-(.*)/!d;s//\1/') |
479 | 479 | fi |
480 | 480 | description=${description%$suffix} |
481 | 481 | description=${description%-} |
… |
… |
|
535 | 535 | # Start with the 'easy' ones |
536 | 536 | date=$(filename_date $filename) |
537 | 537 | [ -z "$date" ] && return |
538 | | prefix=$(echo $filename|sed -r '/(.*)-'$date'.*/!d;s//\1/') |
539 | | nn=$(echo $filename|sed -r '/'$prefix'-'$date'-([0-9]{2})-.*/!d;s//\1/') |
540 | | extension=$(echo $filename|sed -r '/.*[.](.*)/!d;s//\1/') |
| 538 | prefix=$(echo $filename|sed -E '/(.*)-'$date'.*/!d;s//\1/') |
| 539 | nn=$(echo $filename|sed -E '/'$prefix'-'$date'-([0-9]{2})-.*/!d;s//\1/') |
| 540 | extension=$(echo $filename|sed -E '/.*[.](.*)/!d;s//\1/') |
541 | 541 | [ ! -z "$extension" ] && p_extension=.$extension |
542 | 542 | |
543 | 543 | # Special case: evt files end in .ccc.evt where 'c' is any character |
544 | 544 | if [ "$extension" == "evt" ] |
545 | 545 | then |
546 | | evt=$(echo $filename|sed -r '/.*[.](.{3})[.]'$extension'/!d;s//\1/') |
| 546 | evt=$(echo $filename|sed -E '/.*[.](.{3})[.]'$extension'/!d;s//\1/') |
547 | 547 | [ ! -z "$evt" ] && p_evt=.$evt |
548 | 548 | fi |
549 | 549 | |
550 | 550 | # Deal with the 'hard' end of the filename |
551 | | end=$(echo $filename|sed -r '/'$prefix'-'$date'-'$nn'-(.*)'$p_evt$p_extension'/!d;s//\1/') |
552 | | NNN=$(echo $end|sed -r '/.*-([0-9]+).*/!d;s//\1/') |
| 551 | end=$(echo $filename|sed -E '/'$prefix'-'$date'-'$nn'-(.*)'$p_evt$p_extension'/!d;s//\1/') |
| 552 | NNN=$(echo $end|sed -E '/.*-([0-9]+).*/!d;s//\1/') |
553 | 553 | description=${end%-$NNN} |
554 | 554 | description=${description%$p_evt} |
555 | 555 | if [ -z "$suffix" ] && ! $no_suffix |
556 | 556 | then |
557 | | suffix=$(echo $description|sed -r '/.*-(.*)/!d;s//\1/') |
| 557 | suffix=$(echo $description|sed -E '/.*-(.*)/!d;s//\1/') |
558 | 558 | fi |
559 | 559 | description=${description%-$suffix} |
560 | 560 | |
… |
… |
|
585 | 585 | local filename=$1 |
586 | 586 | |
587 | 587 | # Case 1: date is specified as YYYYMMDD in the file name |
588 | | d=$(echo $filename | sed -r '/.*([0-9]{8}).*/!d;s//\1/') |
| 588 | d=$(echo $filename | sed -E '/.*([0-9]{8}).*/!d;s//\1/') |
589 | 589 | # Case 2: date is specified as YYYY-MM-DD in the file name |
590 | | [ -z "$d" ] && d=$(echo $filename | sed -r '/.*([0-9]{4}-[0-9]{2}-[0-9]{2}).*/!d; s//\1/') |
| 590 | [ -z "$d" ] && d=$(echo $filename | sed -E '/.*([0-9]{4}-[0-9]{2}-[0-9]{2}).*/!d; s//\1/') |
591 | 591 | |
592 | 592 | echo $d |
593 | 593 | } |
… |
… |
|
601 | 601 | local d |
602 | 602 | |
603 | 603 | # Case 1: date is specified as YYYYMMDD in the file name |
604 | | d=$(echo $1 | sed -r '/.*([0-9]{4})([0-9]{2})([0-9]{2}).*/!d;s//\1-\2-\3/') |
| 604 | d=$(echo $1 | sed -E '/.*([0-9]{4})([0-9]{2})([0-9]{2}).*/!d;s//\1-\2-\3/') |
605 | 605 | # Case 2: date is specified as YYYY-MM-DD in the file name |
606 | | [ -z "$d" ] && d=$(echo $1 | sed -r '/.*([0-9]{4}-[0-9]{2}-[0-9]{2}).*/!d; s//\1/') |
| 606 | [ -z "$d" ] && d=$(echo $1 | sed -E '/.*([0-9]{4}-[0-9]{2}-[0-9]{2}).*/!d; s//\1/') |
607 | 607 | |
608 | 608 | echo $d |
609 | 609 | } |
… |
… |
|
705 | 705 | for (( i=0;i<$n;i++ )) |
706 | 706 | do |
707 | 707 | suffix=$(get_suffix $i ${suffixes[*]}) |
708 | | file_list="$file_list $(ls ../$directory-$suffix|cut -d/ -f 3|sed -r 's/(.*)-'$suffix'.*/\1/g')" |
| 708 | file_list="$file_list $(ls ../$directory-$suffix|cut -d/ -f 3|sed -E 's/(.*)-'$suffix'.*/\1/g')" |
709 | 709 | done |
710 | 710 | |
711 | 711 | # List all sessions |
diff -ur scripts/ndm_recolorchannels scripts/ndm_recolorchannels
|
|
|
77 | 77 | command='/'$s'/N;/'$s'/N;/'$s'/s/#....../#'${color[$i]}'/g;'$command |
78 | 78 | done |
79 | 79 | |
80 | | [ ! -z "$command" ] && sed -i -e $command $file |
| 80 | [ ! -z "$command" ] && sed -i '' -e $command $file |
diff -ur scripts/ndm_start scripts/ndm_start
|
|
|
267 | 267 | then |
268 | 268 | echo_warning "directory name '$directory' does not seem to contain a date" |
269 | 269 | else |
270 | | sed -i 's/<date>.*<\/date>/<date>'$d'<\/date>/' $template.xml |
| 270 | sed -i '' 's/<date>.*<\/date>/<date>'$d'<\/date>/' $template.xml |
271 | 271 | fi |
272 | 272 | if [ -f $directory.xml ] && ! diff -I '<date>' -q $template.xml $directory.xml >/dev/null |
273 | 273 | then |
diff -ur scripts/ndm_transcodevideo scripts/ndm_transcodevideo
|
|
|
56 | 56 | # // Process |
57 | 57 | # //////////////////////////////////////////////////////////////////////////////////////////////// |
58 | 58 | |
59 | | input_codec=$(ffmpeg -i $video_file 2>&1|grep "Video:"|sed -r 's/.*Video: ([0-9A-Za-z]{4}).*/\1/') |
| 59 | input_codec=$(ffmpeg -i $video_file 2>&1|grep "Video:"|sed -E 's/.*Video: ([0-9A-Za-z]{4}).*/\1/') |
60 | 60 | if [ "$input_codec" == "IV50" ] && [ "$(uname -m)" == "x86_64" ] |
61 | 61 | then |
62 | 62 | # Intel Indeo V5.0 (IV50) is a proprietary codec used by Spike2, that can be decoded only by the 32bit version |
diff -ur scripts/process_renameevents_SPWR scripts/process_renameevents_SPWR
|
|
|
30 | 30 | [ -z "$(ls $session*evt 2> /dev/null)" ] && exit $NO_ERROR |
31 | 31 | for eventfile in $session*evt |
32 | 32 | do |
33 | | sed -i \ |
| 33 | sed -i '' \ |
34 | 34 | -e 's/[[:space:]]0$/\tStimulation/' \ |
35 | 35 | -e 's/[[:space:]]1$/\tRipple Left/' \ |
36 | 36 | -e 's/[[:space:]]2$/\tRipple Right/' \ |
diff -ur scripts/process_renameevents_TMaze scripts/process_renameevents_TMaze
|
|
|
27 | 27 | [ -z "$(ls $session*evt 2> /dev/null)" ] && exit $NO_ERROR |
28 | 28 | for eventfile in $session*evt |
29 | 29 | do |
30 | | sed -i \ |
| 30 | sed -i '' \ |
31 | 31 | -e 's/[[:space:]]0$/\tTurn left/' \ |
32 | 32 | -e 's/[[:space:]]1$/\tTurn right/' \ |
33 | 33 | -e 's/[[:space:]]100$/\tTrial start/' \ |