Help needed executing sh script

Hi, I am not familiar with Shell scripting whatsoever and found this script from a Russian site for audio sampling in osx 10.4.11.

The script is designed to convert a .cue file to a label.txt in the same directory as the .cue file for use in Audacity.

When trying to run this in Terminal im getting this message:

simon-smiths-power-mac-g5:~/Desktop Si$ ./cue2labels.sh
cat: : No such file or directory
sed: illegal option -- r
usage: sed script [-Ean] [-i extension] [file ...]
       sed [-an] [-i extension] [-e script] ... [-f script_file] ... [file ...]
sed: : No such file or directory
./cue2labels.sh: line 1: sox: command not found
sed: illegal option -- r
usage: sed script [-Ean] [-i extension] [file ...]
       sed [-an] [-i extension] [-e script] ... [-f script_file] ... [file ...]
simon-smiths-power-mac-g5:~/Desktop Si$ 

Please, can anyone shed some light on this?

Welcome to the forum. Could you post cue2labels.sh, otherwise we're a bit in the dark ...

Probably you have to need modify the script to your locales..if you can post this script maybe can take help

Ok the instructions to run this command are given as:

works like this:

./cue2labels.sh File_name.cue

result is a file labels.txt that appears in the current directory.

I've attached both files. (the cue file i've added ".txt" to the extension to upload it here)

I can try a few test on orginal script and check result is like below except but there are some errors in orginal script and in the script the sox usage in probably false or version differ because --i parameter is not valid in Version 12.18.1 and because of i removed sox command)

Then i modified a little :wink:
can you check that are results are you wanted like ?

# ./justdoit File_name.cue
0.000000 341,364500 01 - 2
341,364500 640,27000 02 - 3
640,27000 1024,27000 03 - 4
1024,27000 1308,459000 04 - 5
1308,459000 1678,243000 05 - 6
1678,243000 2019,580500 06 - 7
2019,580500 2334,243000 07 - 8
2334,243000 2732,472500 08 - 9
2732,472500 3116,472500 09 - 10
3116,472500 3477,351000 10 - 11
3477,351000 3946,688500 11 - 12
3946,688500 4273,810000 12 - 13
#! /bin/bash
# ygemici ## justdoit
 
if [ -f labels.txt ] ; then rm labels.txt ; fi
cue_fname="$1"
file_name=$(sed -n '/FILE/s/.*"\(.*\)".*/\1/p' "$cue_fname")
cue_tmp=$(sed -n '/.*:.*:.*/{/.*00:.*/d;s/.* \(.*\)/\1/p}' "$cue_fname" )
frstdrt="0.000000" ; trcknmbr=1;
for line_cue in $cue_tmp
  do
       lstdrt=$(eval echo $(sed 's/\(.*\):\(.*\):\(.*\)/$((\1*60+\2)),$((\3*13500))/' <<<"$line_cue") )
       echo "$frstdrt" "$lstdrt" $(echo $trcknmbr|sed 's/^.$/0&/') "- $((++trcknmbr))" >>labels.txt
       frstdrt="$lstdrt"
  done
more labels.txt

regards
ygemici

In addition I noticed that the script requires GNU sed and sox. So you need to install those in any case on your machine for cue2labels.sh script to work.

actually in my script sox is not necessary..because the sox command where in original script not working properly and i cant guess what is sox's result..
to org script it uses FILE_NAME that is mp3 file name in determined clue file and it has grep Duration and if we start off from this maybe sox's result is gving duration times.but i find already in the duration times clue file..then i remove sox command (already it gives error)

portion of from org script

 
CUE_TMP=$( sed -n '/\<INDEX\>/p' "$CUE_FILE_NAME" |\
grep -Eo '..:..:..' | sed '1 d' && sox --i "$FILE_NAME" |\
grep -E '\<Duration\>' | grep -Eo '[0-9]{2}:[0-9]{2}\.[0-9]{2}' |\
sed -r 's/\./:/g;s/\<00:00:00\>//g') 

Hi guys, firstly thanks for your time in looking into this for me. Please accept my apologies for lack of understanding using Terminal but Ygemici, how do I get your code to run properly here? From opening Terminal, what steps did you take to run your script?

From what I understand sox is needed to determine audio track duration, in particular the last track in the cue file. Your code shows the results listed for 12 tracks with track 13 time index missing.

I downloaded the sox file from the following site:

SoX - Sound eXchange | HomePage

h t t p://sourceforge.net/projects/sox/files/sox-macosx/14.3.1/sox-14.3.1-macosx.zip/download

I've attached a copy of the original label.txt so you can compare results from your script.