Not able to get result to unix variables


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Not able to get result to unix variables
# 8  
Old 02-15-2010
Try:
Code:
Srcreccnt=$(wc -l < $(ls ${SOURCE_DIR}/ATRPU_RP_ATU_*.csv | head -1))

# 9  
Old 02-16-2010
Hi friends,

I tried the below and got error message as

1.)
Code:
Tgtreccnt=cat `ls /grid/PowerCenter/stage/velocity_r3_dev/outbound/ATRPU/archive/IMF_ATRPU_*.csv | tail -1`|wc -l

Error msg:

Code:
etl-kn-t2-etluser : Tgtreccnt=cat `ls /grid/PowerCenter/stage/velocity_r3_dev/outbound/ATRPU/archive/IMF_ATRPU_*.csv | tail -1`|wc -l
ksh: /grid/PowerCenter/stage/velocity_r3_dev/outbound/ATRPU/archive/IMF_ATRPU_15022010154332.csv: cannot execute
       0
etl-kn-t2-etluser :

2.) tried like this again and got the error as
Code:
Tgtreccnt=`cat ls /grid/PowerCenter/stage/velocity_r3_dev/outbound/ATRPU/archive/IMF_ATRPU_*.csv | tail -1|wc -l`

Tgtreccnt=`cat ls /grid/PowerCenter/stage/velocity_r3_dev/outbound/ATRPU/archive/IMF_ATRPU_*.csv | tail -1|wc -l`etl-kn-t2-etluser : Tgtreccnt=`cat ls /grid/PowerCenter/stage/velocity_r3_dev/outbound/ATRPU/archive/IMF_ATRPU_*.csv | tail -1|wc -l`
cat: cannot open ls
etl-kn-t2-etluser :

Gurus, Please help me to sort this out..

---------- Post updated at 05:36 AM ---------- Previous update was at 03:24 AM ----------

1000 Thanks scrutinizer. it worked

Last edited by Franklin52; 02-16-2010 at 04:56 AM.. Reason: Please use code tags!
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX and Linux Applications

Passing variables from UNIX to Ansible to UNIX shell

I m passing a variable stringg from Unix shell which has value 'Good Day' to ansible and from ansible to a second shell script where it print only Good instead of 'Good Day' passing the variable stringg from unix shell script1.sh echo $stringg ansible-playbook install.yml -i... (1 Reply)
Discussion started by: mohtashims
1 Replies

2. Shell Programming and Scripting

How to compare the current result with previous line result.?

Hi Gurus, I have requirement to compare current result with previous reuslt. The sample case is below. 1 job1 1 1 job2 2 1 job3 3 2 job_a1 1 2 job_a2 2 2 job_a3 3 3 job_b1 1 3 job_b2 2 for above sample file, GID is group ID, for input line, the job run... (1 Reply)
Discussion started by: ken6503
1 Replies

3. UNIX for Advanced & Expert Users

How to export Result to Excel Tabular format from UNIX?

Hi I am working on a script in which I am firing a query on database through Unix and getting the result set. I want to export that in an excel file. I am able to do so nut the result are exported horizontally one below the other. Can anyone plss help me out in exporting the Result in Tabular... (4 Replies)
Discussion started by: Saritau3
4 Replies

4. Shell Programming and Scripting

assinging the printf result to variables

Getting the below error while executing this. Able to run the below commands Individually. #!/bin/bash a=$(printf "%d\n" 0x01E); b=$(printf "%d\n" 0x01A); echo $a echo $b c=`expr $a - $b` echo $c syntax error at line 2: `a=$' unexpected (2 Replies)
Discussion started by: sai_1712
2 Replies

5. Shell Programming and Scripting

Variables in unix

Hi, I have defined 2 variables in a ksh file something like below. x=abc y=x Now, I want to get abc printed using y. I have tried echo $"$y" and I am getting $x but where as I am expecting abc. Please suggest. (something like pointer pointer in C language) (2 Replies)
Discussion started by: ravinunna
2 Replies

6. UNIX for Dummies Questions & Answers

UNIX newbie with a really odd result!

I am relatively new to UNIX and am having some really weird results with redirecting output. I will start at the beginning. I have a file with consists of a list of a chemical name followed by a tab and then a string of characters known as a SMILE string in this format PS_1 C=C PS_2 ... (4 Replies)
Discussion started by: Osito22es
4 Replies

7. UNIX for Dummies Questions & Answers

Script giving different result on Linux compared to Unix

Hi I have a script executing fine in Unix but in linux I am getting different result. I have three files under /local/home/temp/Gen test.sh list.txt shst.txt Contents of test.sh -------------------------- #!/bin/ksh K=0; SCRIPT_DIR=/local/home/temp/Gen cat... (2 Replies)
Discussion started by: malavm
2 Replies

8. UNIX for Dummies Questions & Answers

display the result of wc -l with words before and after the result

hello showrev -p | wc -l returns: 381 What to do in case I want to have this output: number of lines returned by showrev -p is: 381 thx (3 Replies)
Discussion started by: melanie_pfefer
3 Replies

9. Shell Programming and Scripting

Outputting formatted Result log file from old 30000 lines result log<help required>

Well I have a 3000 lines result log file that contains all the machine data when it does the testing... It has 3 different section that i am intrsted in 1) starting with "20071126 11:11:11 Machine Header 1" 1000 lines... "End machine header 1" 2) starting with "20071126 12:12:12 Machine... (5 Replies)
Discussion started by: vikas.iet
5 Replies

10. Shell Programming and Scripting

how to retrieve sql result to unix....

Hi, i would like to retrieve seql result and write it into unix text file like "result.txt" In unix, normally, I type "sql" and get into sql,then type "select....." to run and get the result....then copy and paste into result.txt any possible way to write a script to run it automatically?... (3 Replies)
Discussion started by: happyv
3 Replies
Login or Register to Ask a Question