finish of file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting finish of file
# 1  
Old 06-13-2010
finish of file

Hello,
I'm doing a script where I'm traveling a file, and moves down line by line, and is copied to another file, up to the line 100, then the smaller file passes to another format ... but the problem I have is that if there are 357 lines for example, file 1 2 i 3, converted correctly but the 4 and has not reached the 100 lines, I do not format converter. Here is the script:


Code:
while read line
do
   echo "$ line">> file $ contador_fichero.txt
if [$ num_lines-eq $ lines];
  Then
      num_lines = 0
      temp = `cat $ $ 1` contador_fichero.txt
      echo $ temp | iconv-f-t utf-8 iso-8859-1 | text2wave-scale 5.0-o $ nom $ contador_fichero.wav
      =$(($ contador_fichero contador_fichero +1))
   else
     =$(($ num_lines num_lines +1))
   fi
  done <$ nom

As I can do that in the IF is, or equal to 100, or end of file?

Thanks

Last edited by vgersh99; 06-13-2010 at 02:18 PM.. Reason: code tags, please!
# 2  
Old 06-14-2010
Quote:
Originally Posted by uri_crack
Hello,
I'm doing a script where I'm traveling a file, and moves down line by line, and is copied to another file, up to the line 100, then the smaller file passes to another format ... but the problem I have is that if there are 357 lines for example, file 1 2 i 3, converted correctly but the 4 and has not reached the 100 lines, I do not format converter. Here is the script:


Code:
while read line
do
   echo "$ line">> file $ contador_fichero.txt
if [$ num_lines-eq $ lines];
  Then
      num_lines = 0
      temp = `cat $ $ 1` contador_fichero.txt
      echo $ temp | iconv-f-t utf-8 iso-8859-1 | text2wave-scale 5.0-o $ nom $ contador_fichero.wav
      =$(($ contador_fichero contador_fichero +1))
   else
     =$(($ num_lines num_lines +1))
   fi
  done <$ nom

As I can do that in the IF is, or equal to 100, or end of file?

The script as posted is gibberish. You have spaces where there shouldn't be any, and no spaces where there should be.

There is no keyword "Then" (it's "then"); you cannot start a command with "=".

Etc..

I suggest that you start from scratch with a loop containing a single instruction.

If that works, add the next instruction.

Continue until the script fails, then post the script (using cut and paste; do not retype it) and explain exactly how it fails (cut and paste any error messages into your post).
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

How to finish expanding a zfs filesystem?

I have a esxi 6.7 server running a Solaris 10 x86 vm (actually a bunch of them). The VM uses zfs for the pools (of course). I expand the underlying ESX logical disk, for example from 50GB to 100gb, then I set autoexpand=on <pool> that belongs to the esx logical disk. what am i missing to... (2 Replies)
Discussion started by: mrmurdock
2 Replies

2. Shell Programming and Scripting

Who can finish this script?

Good morning dear friends, I want to write an UNIX script to do the following task: We have 6 directories, called (SMS_01, SMS_02 ....... SMS_06), some files are distributed across these directories, but the distribution process is not good, I mean when I check these directories I found the... (14 Replies)
Discussion started by: Mohannad
14 Replies

3. Shell Programming and Scripting

Waiting a job to finish

Hello again, I am runnning a job on a cluster and I submit a job with the command qsub script.sh where script.sh is a script with the command i want o use. When i enter this command the cluster gives a huber like 123456 as the JOB ID. I want the job to run about 12 hours and when it... (5 Replies)
Discussion started by: lengolass
5 Replies

4. Shell Programming and Scripting

Cannot execute/finish script because of last line syntax error: unexpected end of file/token `done'

first of all I thought the argument DONE is necessary for all scripts that have or begin with do statements which I have on my script, However, I still don't completely understand why I am receiving an error I tried adding another done argument statement but didn't do any good. I appreciate... (3 Replies)
Discussion started by: wolf@=NK
3 Replies

5. Shell Programming and Scripting

Please help me to finish this scripts

Hi All, Can anyone help me to finish the scripts. this scripts is this scripts will run on crontab in every 4 minutes to get the newest router interface status. I would like to add a function to count the router interface flapping, if more than 2 times in 20 minutes (scripts run 5 times)... (1 Reply)
Discussion started by: momo0617
1 Replies

6. Shell Programming and Scripting

Finish script help

I am trying to add a finish script that can copy hosts, static routes and a few other files into relevant directories on a client system. These files would be mounted as nfs resource on the client as hosts.hostname, static_route.hostname etc. Script will compare the hostname of the client and copy... (0 Replies)
Discussion started by: c0kazaz
0 Replies

7. UNIX for Advanced & Expert Users

commands do not finish

Hi, I have strange problem executing some command on solaris 5.9 ps command does not finish(hangs) and runs forever without any result. same with cc command too.Please suggest (1 Reply)
Discussion started by: Raom
1 Replies

8. UNIX for Dummies Questions & Answers

how do i finish this last one..

i tried to build a command to replaces the word "include" with "exclude" in each *.h type of file in a certain directory and to display the lines in which the switch happened. i did a command and i dont know why its not working find /usr -name "*.h" -exec sed 's/include/exclude/g' {} \;... (2 Replies)
Discussion started by: newby2
2 Replies

9. Solaris

Urgent...FTP unable finish download file, hang half way

Hi all, I have 1 problem in my solaris 8 server. The problem is in every nite that will run a cron job to download file from external ftb server. This crob job starter running find, but after running for 4 minute, that ftp services is hang that, until we need kill this process. My question... (3 Replies)
Discussion started by: foongkt5220
3 Replies

10. UNIX for Dummies Questions & Answers

jumpstart - finish scripts

hi, where i can find some help on how to write finish scripts for jump-start?? i tried sun-blueprints but i couldnt find it... (2 Replies)
Discussion started by: dorilevy
2 Replies
Login or Register to Ask a Question