Sponsored Content
Top Forums Shell Programming and Scripting Bc in shell script is creating blank files Post 302901821 by Don Cragun on Thursday 15th of May 2014 10:34:18 PM
Old 05-15-2014
There are several issues here.
  1. What operating system are you using?
  2. What shell are you using?
  3. What errors are you getting from your script?
  4. Is err_list the name of a file, or is it the name of a variable that contains the name of a file?
  5. Are you trying to see if there are more than 2% of a specific type of error as specified by one line in the file named by $err_list, or all types of errors specified by all of the lines in the file named by $err_list?
  6. How is feed_cnt set?
  7. The command:
    Code:
    [ $err_cnt > $err_tol ]

    creates a file named by the expansion $err_tol, and stores the output of the command:
    Code:
    [ $err_cnt ]

    in that file. If you were trying to do a numeric comparison, that would be:
    Code:
    [ "$err_cnt" -gt "$err_tol" ]

    but (unless you're using a 1993 or later version of ksh) that only works for integer values (and, if you're using a 1993 or later ksh, you don't need to use bc to do any of there calculations used here).

Last edited by Don Cragun; 05-15-2014 at 11:37 PM.. Reason: Change order to make list work.
This User Gave Thanks to Don Cragun For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Argument in shell script never blank

Hi All, I have a script which accepts a parameter which can either be blank, a specific value, or a wildcard value. But it never seems to be blank and the wildcard option seems to return the names of matching files in my directory. This happens even with the worlds simplest script that just... (1 Reply)
Discussion started by: cdines
1 Replies

2. UNIX for Dummies Questions & Answers

Script to move blank files

Anyone could give me an example of scrip to move blank files found into a dir? Thanks, Leandro Takeda (3 Replies)
Discussion started by: letakeda
3 Replies

3. Shell Programming and Scripting

Shell script: Remove blank lines

Hi gurus, I have this file with blank lines in it. How do i remove them in shell? I tried these commands but not working: sed '/^ *$/d' or sed '/^$/d' Anybody has a better idea pls? Also there are lines which starts with a single space, how do we remove the space in those lines?... (3 Replies)
Discussion started by: gholdbhurg
3 Replies

4. Shell Programming and Scripting

Blank Space is not appending in each row of CSV File - Shell Script

I am calling SQL script in my UNIX Shell script and trying to create the CSV file and my last column value of each row is 23 blank spaces. In my SQL script,the last column is like below. RPAD(' ',23,' ') -- Padding 23 blank Spaces The CSV file is generated but the sapce(23 spaces) is... (2 Replies)
Discussion started by: praka
2 Replies

5. Shell Programming and Scripting

Dynamically creating text files using shell script

Hi All, I want to create a shell script which dynamically create text files. i am using the following script $i=1 while do cat > test_$i.txt done but while running the script it was stopping(the cursor not going to next step, i have to enter ctrl+c to make it stop). it is creating only... (2 Replies)
Discussion started by: KiranKumarKarre
2 Replies

6. Shell Programming and Scripting

Problem with blank spaces in shell script

Hi, I did the following script: DIR=`pwd`;for i in `find . -name GESTION -type d`;do cd $i/..;setfacl -R -m g:directores:rwx, GESTION;echo $DIR'/'$i;cd $DIR;done This code do the following actions: 1. Starting inside a folder, it's searching for any folder called "GESTION" 2. Every time... (3 Replies)
Discussion started by: argie01
3 Replies

7. Shell Programming and Scripting

shell script to check blank line?

Can someone help to transform the below logic into a shell script, might be easy for some of you. I have a file with below text, I need if the line has the ":" and the above to it is not a blank line should print " <text>: is incorrect format" Apple: vitamin = A... (0 Replies)
Discussion started by: usyseng
0 Replies

8. Shell Programming and Scripting

Need help creating a script to FTP files to a server and then delete the files that were transfered.

I am trying to FTP files to a Windows server through my Linux machine. I have setup the file transfer with no problems but am having problem deleting those files from the Linux box. My current non-working solution is below. Any ideas, anyone?? :wall: Please be gentle, I'm fairly new to this... (4 Replies)
Discussion started by: jmalfhs
4 Replies

9. UNIX for Dummies Questions & Answers

Creating a blank string of a specified size

I want to have a string which has n blank spaces For example set N = 3 create str = " " So the length depends on the value of N. I am in tcsh. (4 Replies)
Discussion started by: kristinu
4 Replies

10. Shell Programming and Scripting

Remove Space and blank line from file in UNIX shell script

I have below file. I want to remove space at begining of every line and then after also remove blank line from file. I use below code for each operation. sed -e 's/^*//' < check.txt > check1.txt sed '/^\s*$/d' < check1.txt > check2.txt above code not remove all the space... (12 Replies)
Discussion started by: Mohin Jain
12 Replies
All times are GMT -4. The time now is 07:36 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy