Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Issue with variable assignation Post 302878970 by abhi_123 on Tuesday 10th of December 2013 02:03:57 AM
Old 12-10-2013
Tools Issue with variable assignation

Hi All,
My files(.csv) are created in download path.
All the files files are having footer with count of rows or may be blank.
When i am trying to put this below code in shell script and run it, the row_num is not getting assigned,
but works correctly on command prompt.
I am trying to put this count into a control file.

Please help me out as to what is worng.
Thanks for the help in advance.

Code:
for i in `find "$download" -name "pos_*.csv"  -exec basename {} \;` ; do

v_ctl_filename=${i%%.*}.ctl
typeset -i row_num=0 
row_num=`tail -1 "$i" |tr -cd '[:digit:]'`
echo $row_num > $SOURCEPATH/$v_ctl_filename

scp command

done

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

VALUE ASSIGNATION TO A VARIABLE

I'm currently trying yo make a script that takes info from a text file but I have a problem with this line: @ count = 0 # variable initialization @ count = grep faildata 3A | grep -c 178 where: "faildata" is the pattern "3A" is the filename What I want is to assign the numeric result of... (1 Reply)
Discussion started by: jelizondo1010
1 Replies

2. Shell Programming and Scripting

sed variable issue

I'm writting a krn shell script and i'm having an issue with a variable using sed. If someone enters a variable with a " /" the sed command doesn't read it right. example. a='12000/10-DC' b='12000/10-AC' cat file | sed "s/$a/$b/" How can i correct this issue? Will the fix to this... (2 Replies)
Discussion started by: wisher115
2 Replies

3. Programming

Have issue with variable

Hi All, i am new to unix.. i have an issue with my unix script...let me explain the task that i want to make script.... i prepared script which will connect data base from my linux box using sqlplus cmd... however in that i want to use the variable like below.. select * from... (0 Replies)
Discussion started by: Shahul
0 Replies

4. Shell Programming and Scripting

Variable sub-menu issue

The code im having problems with is highlighted in red, upon selecting option 2 on the main menu (highlighted green) my echo "NETWORK CONNECTIVITY" command seems to get overlooked and the resulting output is "Thank you for using the Operator Administrative Tool." being displayed. Can anyone tell me... (2 Replies)
Discussion started by: warlock129
2 Replies

5. Shell Programming and Scripting

variable issue

Hi, I'm sure that it's a very simple issue. this is a part of my code : while read ligne do result=`ls -R ../FILES/|grep "."$ligne"$"` echo $result done<TYPE_EXT_FILES.txt the echo return nothing (as my variable is empty). I'm sure that the problem... (10 Replies)
Discussion started by: skubann
10 Replies

6. UNIX for Dummies Questions & Answers

PLease HELP!!! PATH variable issue

Hello, I logged in to the unix solaris with my user name and then I again logged in with the sudo bash -l command now when I do echo $PATH It shows me => /usr/bin:/usr/local/bin:/usr/bin/usr/sbin:/usr/ucb:/usr/local/bin How do i find out where is this file located for setting the... (3 Replies)
Discussion started by: siddhans
3 Replies

7. Shell Programming and Scripting

Issue with AWK using a variable

Hi, I am doing an AWK in ksh as below with the string to search to be read from variable but for some reason there is no output. It works when I hard code it. awk 'substr($0,22,6)=="${VAR}"' XXX.txt' >YYY.txt On reading other posts I tried below option, 'substr($0,22,6)=="/"${VAR}/""' ... (3 Replies)
Discussion started by: junnujayz
3 Replies

8. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

9. UNIX for Dummies Questions & Answers

Variable usage issue

Hi, I need a help in setting scope of the variable. I want to use the below logic right before the "break" statement if ; then echo $header echo $trailer fi But due the scope of the variable it is causing issues. I tried using "export" statement. But it changes the output completely ... (0 Replies)
Discussion started by: Prem148
0 Replies

10. UNIX for Dummies Questions & Answers

Issue with variable within a loop

I have this file (1.txt): >sample TCGGCCCGJOHNTTTTGCGGGCCGCATTGTCGCCAGGCGCDOEGGGGTTTGCGATCGCCACGGGGCTGATGGTGGCGACCCGCTGCACCCGG I am using the following script to "trim" the sequence awk '{gsub(/^.*JOHN|DOE.*$/,"",$0)} 1' This is the output: >sample TTTTGCGGGCCGCATTGTCGCCAGGCGC ... (6 Replies)
Discussion started by: Xterra
6 Replies
CUBRID_NUM_COLS(3)							 1							CUBRID_NUM_COLS(3)

cubrid_num_cols - Return the number of columns in the result set

SYNOPSIS
int cubrid_num_cols (resource $result) DESCRIPTION
The cubrid_num_cols(3) function is used to get the number of columns from the query result. It can only be used when the query executed is a select statement. PARAMETERS
o $result -Result. RETURN VALUES
Number of columns, when process is successful. FALSE, if SQL statement is not SELECT. EXAMPLES
Example #1 cubrid_num_cols(3) example <?php $conn = cubrid_connect("localhost", 33000, "demodb", "dba"); $req = cubrid_execute($conn, "SELECT * FROM code"); $row_num = cubrid_num_rows($req); $col_num = cubrid_num_cols($req); printf("Row Num: %d Column Num: %d ", $row_num, $col_num); cubrid_disconnect($conn); ?> The above example will output: Row Num: 6 Column Num: 2 SEE ALSO
cubrid_execute(3), cubrid_num_rows(3). PHP Documentation Group CUBRID_NUM_COLS(3)
All times are GMT -4. The time now is 11:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy