Grep and dollar command


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Grep and dollar command
# 8  
Old 06-08-2016
Quote:
Originally Posted by skitoc
To vbe :

Code:
duntstudb51:root:/home/jc # (su - db2inst1 -c "db2 get db cfg")|grep -i 'code page'
duntstudb51:root:/home/jc #

In other words, nothing is returned.

To Don Cragub :

"should also work with no problems. But..."

But does not :

Code:
duntstudb51:root:/home/jc # cdeset=$(su - db2inst1 -c "db2 get db cfg" | grep -i 'code page')
duntstudb51:root:/home/jc # echo $cdeste

duntstudb51:root:/home/jc #

But your explanation brings me a lot of interesting information...

Well guys, that's ok for me tonight. Late in France, have to go to bed, was called yesterday, for my on call period ;-)

Thank you so much for your help. Sincerly. I do appreciate.

Back tomorrow that is another day.

Smilie

JC
I can't explain why you aren't getting any output from the first command you have shown us above. But there is no surprise in the second set of commands providing no output. If you assign output to a variable named cdeset and print the contents of a different variable (cdeste) (that as near as well can tell has never been assigned any value), it is no surprise that the echo only produces an empty line as output.

Just for the fun of it, what operating system are you using? And, although you have said you are using the Korn shell, what shell is the login shell for root on your system?
# 9  
Old 06-09-2016
To Don Cragun :

Sorry for this mistake. Unfortunatly, even after correction, the result is the same for the piece of code following :

Code:
duntstudb51:root:/ # cdeset=$(su - db2inst1 -c "db2 get db cfg" | grep -i 'code page')
duntstudb51:root:/ # echo $cdeset

duntstudb51:root:/ #

The OS is an IBM AIX 7.1 and the login shell is ksh.

JC
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Ignore dollar value in sed

Hi Guys, I need to replace the string based on specific value by keeping dollar sign input=$1 var=$(echo "@code_temp_table_$value_table"| sed -r "s/\@code/${input}/;s/(nz|sa)_\$value_/\$value1_\1_/" ) Expected if input=nz,sa then nz_temp_table_$value1_table else if any other... (5 Replies)
Discussion started by: Master_Mind
5 Replies

2. AIX

Implementing PowerVM without spending a single dollar

Hi experts. I want to setup a training lab. I have a Power 5 standalone server 9110-51A (p5 510) I want to enable PowerVM on it and create two LPARs I don't have money for an HMC I know I can use IVM instead I understand IVM is part of the VIOS software TWO QUESTIONS: 1- If... (12 Replies)
Discussion started by: livehho
12 Replies

3. Shell Programming and Scripting

[Solved] cp command with dollar variable in ksh

hi, I have been trying to acheive the following task for a while now, but failed.. Need help, experts please help! This is what I am trying to do: - I am writing to a flat file the name of the source to be copied and the destination path as to where it is to be copied to. Sample flat file:... (7 Replies)
Discussion started by: abdulhusein
7 Replies

4. Shell Programming and Scripting

substitute the starting dollar sign in command with blank

Hi,, Let example cmd: $$config/all Here I want to replace or subsitute blank space and also with any other character in place of "$" sign...and also want to replace backslash (/) with forward (\)......in expect script please could any one help on this.....thank you (2 Replies)
Discussion started by: swethakast
2 Replies

5. Shell Programming and Scripting

problem in dollar substitution

Hi, I have a problem in dollar substitution:- $ csv1="first_csv" $ csvnumber=1 $ echo {csv$csvnumber} {csv1} $ echo "${csv$csvnumber}" bad substitution I want first_csv...why is it not working thanks (2 Replies)
Discussion started by: scripter12
2 Replies

6. Shell Programming and Scripting

how to escape dollar in unixcommand

i have my @tmp = `egrep 'jpg$|gif$' output.txt`; perl assumes $ as a variable; i tried escaping but failed please help me (5 Replies)
Discussion started by: phoenix_nebula
5 Replies

7. What is on Your Mind?

65 thousand dollar question

I was just a-wondering through some hardware and software sites, and in one of them, I was scrolling down a UNIX os page when I noticed that the prices for these OS's were climbing alarmingly high; in the 5 to 10 G's. Imagine my surprise when I saw one particular UNIX os selling for 65 freakin'... (10 Replies)
Discussion started by: mud
10 Replies

8. Shell Programming and Scripting

Sum Dollar Amounts

I get a transaction file and I need to sum two of the columns. I each record I get a debit(D) or credit(C) indicator. Then I get an amount field. I need to sum the total dollar value of debits and credits. I know I can loop through each record and get the sum total but is there a better way with... (7 Replies)
Discussion started by: lesstjm
7 Replies

9. UNIX for Dummies Questions & Answers

using $ dollar symbal as text

All, How can I get unix to handle the symbol $ as text rather than thinking its a variable value. e.g When calling a sql script from unix: exec SQL_PACKAGE('OPS$JOHN.EMP') where OPS$JOHN is the owner of the table ($JOHN is not a variable!) Thanks (1 Reply)
Discussion started by: ramit
1 Replies
Login or Register to Ask a Question