Page 1 of 1

basic script help

Posted: April 14th, 2013, 10:46 am
by mishou
Hi,

I'm trying to convert mp4 to avi
I started with a script that list mp4 (or mkv) files and then process them but I'm stuck at the first step
The list created of mp4 files has this content:
S01E08 - Veritas.mp4
S01E09 - Ouroboros.mp4
but the echoing from the for loop is not using the whole name and is using the blank spaces as separators
giving me the output like this

S01E08
-
Veritas.mp4
S01E09

my test script

#!/bin/sh
FFMPEG=/usr/bin/ffmpeg
MEDIAINFO=/usr/bin/mediainfo
FOLDER="/media/Volume0/TV/House of Lies/Season 1"
EPLIST=/home/mishou/list-files.txt

echo $FOLDER
cd "$FOLDER"
ls |grep mp4 > $EPLIST
ls |grep mkv >> $EPLIST

for EPISODE in `cat $EPLIST`
do
echo $EPISODE
# process episode
done

any ideas of what I'm doing wrong ?

Thank you
Mishou

Re: basic script help

Posted: April 14th, 2013, 12:24 pm
by sander
Why not use awk?

cat $EPLIST | awk '{ print "here it is:" $0 }'

Re: basic script help

Posted: April 14th, 2013, 2:30 pm
by mishou
Yes that worked.
Thanks