1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash
# Concatenates two video files.
# Codifing on the fly.
# Fede Diaz (aka nordri) nordri at gmail.com
# http://nordri.blogsome.com
# Jun 27 2009

STRING="";
FLAG=0;

for file in *.avi;
  do ls $file | grep -i cd1 >/dev/null;
  if [ $? -eq 0 ]; then
    STRING=" $file ";
	FLAG=0
  else
    STRING="$STRING $file " ;
	FLAG=1;
  fi;
  if [ $FLAG -eq 1 ]; then
    echo "Concatenating . . .";
    cat $STRING > CAT.$file;
	echo "Coding . . .";
	mencoder -ovc copy -oac copy -forceidx -o MEN.$file CAT.$file;
	echo "Cleaning";
	rm -v $STRING CAT.$file
  fi;
  done