Help needed executing sh script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help needed executing sh script
# 1  
Old 11-13-2010
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:
Code:
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?

Last edited by Scott; 11-13-2010 at 09:32 AM.. Reason: Code tags
# 2  
Old 11-13-2010
Welcome to the forum. Could you post cue2labels.sh, otherwise we're a bit in the dark ...
# 3  
Old 11-13-2010
Probably you have to need modify the script to your locales..if you can post this script maybe can take help
# 4  
Old 11-13-2010
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)
# 5  
Old 11-14-2010
MySQL

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 Smilie
can you check that are results are you wanted like ?

Code:
# ./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

Code:
#! /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
# 6  
Old 11-14-2010
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.
# 7  
Old 11-14-2010
Quote:
Originally Posted by Scrutinizer
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 gıving 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
Code:
 
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')

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Executing Oracle script from UNIX Script

Hi, I am new to UNIX and want to execute oracle script from unix script. I have written below script but i am getting below error. #!/bin/bash file="/home/usr/control/control_file1" while read line do #$line=@$line #echo $line sqlplus tiger/scott@DB @$line exit #echo "$line" done... (3 Replies)
Discussion started by: vipin kumar rai
3 Replies

2. UNIX for Dummies Questions & Answers

Script dosent exits after executing the script

Hi i wrote a script which dosent exists after executing any help #!/bin/bash netstat -ptlen | grep 10000 if ; then echo "Hive Thrift server is running" exit 0 else echo "Hive Thrift server is down Trying to Bring up the service" | mail -s "ALERT" team@domain.com `nohup hive... (7 Replies)
Discussion started by: vikatakavi
7 Replies

3. Shell Programming and Scripting

Script not executing

Hi, am facing some problem while inserting a record into a script Please find script below. `sqlplus -s asdf/asdf123 <<eof! set feedback off; set heading off; set verify off; insert into... (3 Replies)
Discussion started by: senkerth
3 Replies

4. UNIX for Dummies Questions & Answers

Help with executing script

Dear All, I have a script on my USB and I want to execute it on set of files when I connect via ssh on the server ... I'm not able to define the path of the script located in the USB ... how can I use this script without copying/moving it into the directory I'm working on in the ssh mode ....... (6 Replies)
Discussion started by: pawannoel
6 Replies

5. Shell Programming and Scripting

SCRIPT NOT EXECUTING

HI All, The below shown script whcih is executing wrongly Actually i have three inputs from user FILE NAME :INPUTS CONFRIM FILE NAME :Y or N CONFIRM PATH :/ or . by depending on the user input the script have to execute the find command in the root path or in the home... (3 Replies)
Discussion started by: thelakbe
3 Replies

6. Shell Programming and Scripting

Variables of executed script available in executing script

Hi, I have a script get_DB_var.ksh which do a data base call and get some variables as below: sqlplus -silent $user/$pass@dbname <<END select col1, col2, col3 from table_name where col4=$1; exit; END Now I want to access all these variables i.e.... (9 Replies)
Discussion started by: dips_ag
9 Replies

7. UNIX for Advanced & Expert Users

Executing a shell script from windows;script present in unix

I need to execute a shell script kept in unix machine from windows. User id, password area available. For eg. There's a shell script wich moves all the logs kept in my home directory to a directory named LOGS. Now i need to get this done through windows; either using a batch file, or java... (4 Replies)
Discussion started by: rajneesh_kapoor
4 Replies

8. Solaris

executing cgi programs in solaris(B89) needed urgent help,pls!

Hi all, I am trying to execute cgi scripts on solaris, but everytime i get a internal server error... The syntax of my .cgi script is correct as ive checked.. Steps i followed 1.started apache 2.The UNIX and Linux Forums - Learn UNIX and Linux from Experts (in opera) 3.places my cgi scripts... (7 Replies)
Discussion started by: wrapster
7 Replies

9. Shell Programming and Scripting

script not executing

Hi , Kindly advice whats wrong with this script. It is not executing. ...# #!/bin/ksh find. -name "b.log" if ; then echo "1" fi ...# Thanks (5 Replies)
Discussion started by: himvat
5 Replies

10. Shell Programming and Scripting

script not executing

test:/oracle/home $ ex_im1.sh ksh: exp_imp1.sh: not found $echo $SHELL /bin/ksh ex_im1.sh has rwxr--r-- permissions thanks (3 Replies)
Discussion started by: dreams5617
3 Replies
Login or Register to Ask a Question