It has been long time since my last bash script. I m just trying to extract the content of a file from the the start variable to the stop one. My source file is night4.info and it contains a list of .jpg files.The structure of this file is similar to:
./2014-11-02/18h/00mn/2014-11-02T18-00-00.048000-depth.jpg
./2014-11-02/18h/00mn/2014-11-02T18-00-00.182000-depth.jpg
./2014-11-02/18h/00mn/2014-11-02T18-00-00.316000-depth.jpg
This is the code so far :
#! /bin/bash
start=$(grep -n $1 night4.info | cut -d : -f 1)
stop=$(grep -n $2 night4.info | cut -d : -f 1)
echo "1" >> list.info
sed -n -e "$start,$stop p" night4.info >> list.info
And this is how I m running my script:
./script1.sh 2014-11-02T18-00-00.048000 2014-11-03T06-59-59.981000
There is no error message and the code doesn't give the right output.