Sponsored Content
Top Forums Shell Programming and Scripting Error with expr - "expr: syntax error" Post 302601299 by methyl on Thursday 23rd of February 2012 10:15:48 AM
Old 02-23-2012
Once your "wc -l" line found more than one file it output more than one line and a "total" line.
Assuming that you want to process file-by-file:
Code:
       ls -1 ${common_path_in}/$i/*.csv | while read filename
        do
                tot_rec_count=`wc -l "${filename}" | cut -f1 -d' '`

This User Gave Thanks to methyl For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

expr: syntax error. why?

i want to get a substring from a string and used such shell script: var_year=`expr substr "07132006" 5 4` echo $var_year but i got such error message: expr: syntax error. why? Note: Kshell used on solaris 8. :confused: (5 Replies)
Discussion started by: robin.zhu
5 Replies

2. Shell Programming and Scripting

why "expr "${REPLY}" : '\([1-9][[:digit:]]*\)" can figure out whether it is a digit?

I found below script to check whether the variable is a digit in ksh. ############################ #!/bin/ksh REPLY="3f" if ]*\)'` != ${REPLY} && "${REPLY}" != "0" ]] then print "is digit\n" else print "not digit\n" fi ############################ Although it works fine, but... (6 Replies)
Discussion started by: sleepy_11
6 Replies

3. Shell Programming and Scripting

"syntax error at line 21 :'done' unexpected." error message"

I am trying to run the script bellow but its given me "syntax error at line 20 :'done' unexpected." error message" can someone check to see if the script is ok? and correct me pls. Today is my first day with scripting. Gurus should pls help out #!/bin/ksh # Purpose: Check to see if file... (3 Replies)
Discussion started by: ibroxy
3 Replies

4. Shell Programming and Scripting

HowTo: reg expr doing grep "timestamp>$DesiredTime" logfile ?

I know I asked a similar question but I want to know if there is a regular expression existing that with a korn shell cmd, finds any timestamp data records in a file where it is greater then a timestamp in a shell variable ? something like : grep all records where it has a timestamp >... (5 Replies)
Discussion started by: Browser_ice
5 Replies

5. Shell Programming and Scripting

convert a=(b/100)*a into a "expr" expression

Hi Guys, THis is the first time am using the expr expression. I like to know how to write the expression a=(b\100)*a. THis works fine if it gives without a bracket. the bracket should be present as i wanted to define the order of execution. Help me out. Thanks for your help in advance.... (2 Replies)
Discussion started by: mac4rfree
2 Replies

6. UNIX for Dummies Questions & Answers

expr - Syntax error

hello to everyone, i am writing a shell script in unix and i use the following command: lnum= cut -f 1 -d : aa passline=`expr $lnum + 1` echo "$passline" with the following command i get the value that is stored in the first field of the file "aa" and i save it in the variable "lnum". i am... (2 Replies)
Discussion started by: omonoiatis9
2 Replies

7. UNIX for Dummies Questions & Answers

expr: syntax error

Hi All, This is a piece of code from one of my scripts: t1=`cat temp3.21447 | grep WEALTHTOUC_TRANS_20100409_233127.txt.txt.TRG | awk '{print $3}' | cut -c1-5` t2=`cat temp3.21447 | grep WEALTHTOUC_TRANS_20100409_233127.txt.txt.TRG | awk '{print $5}' | cut -c1-5` #t1=23:43... (5 Replies)
Discussion started by: prachiagra
5 Replies

8. Homework & Coursework Questions

How to lclear "expr: syntax error" eventhough everything looks fine?

Hi All, As per my knowledge in unix, my code looks fine. But still I am getting error (expr:syntax error). Please help me to resolve this error. Script : PRE_LBNO=0 PRE_DATE=0 TOT_PAY=0 TOT_REM=0 TOTAL=1 for Record_Type in `cut -c 1 Inputt.dat` do if ; then CURR_LBNO=` cut -c... (6 Replies)
Discussion started by: lathanandhini
6 Replies

9. Shell Programming and Scripting

Commenting out "expr" creates weird behavior

This really puzzles me. The following code gives me the error 'expr: syntax error' when I try to do multi-line comment using here document <<EOF echo "Sum is: `expr $1 + $2`" EOF Even if I explicitly comment out the line containing the expr using "#", the error message would still exist... (3 Replies)
Discussion started by: royalibrahim
3 Replies

10. Shell Programming and Scripting

Expr: non-numeric argument syntax error on line 1, teletype

Hi, I tried to look up the issue i'm experiencing, but i'm confused what's wrong with my script. After executing the script I'm getting the following error expr: non-numeric argument syntax error on line 1, teletype After some research, it seems that the problem relates to bc. I have... (1 Reply)
Discussion started by: nms
1 Replies
SETCAP(8)						      System Manager's Manual							 SETCAP(8)

NAME
setcap - set file capabilities SYNOPSIS
setcap [-q] [-v] (capabilities|-|-r) filename [ ... capabilitiesN fileN ] DESCRIPTION
In the absence of the -v (verify) option setcap sets the capabilities of each specified filename to the capabilities specified. The -v option is used to verify that the specified capabilities are currently associated with the file. The capabilities are specified in the form described in cap_from_text(3). The special capability string, '-', can be used to indicate that capabilities are read from the standard input. In such cases, the capabil- ity set is terminated with a blank line. The special capability string, '-r', is used to remove a capability set from a file. The -q flag is used to make the program less verbose in its output. EXIT CODE
The setcap program will exit with a 0 exit code if successful. On failure, the exit code is 1. SEE ALSO
cap_from_text(3), cap_set_file(3), getcap(8) 24th October 2008 SETCAP(8)
All times are GMT -4. The time now is 04:15 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy