10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
Hi,
I am attempting to assign the output of the following command, to two bash variables, var1 and var2 using "read," but it doesn't seem to be working.
# openstack hypervisor stats show | awk -F'|' 'NR==14{print $2,$3}'
vcpus 92
# echo $?
0
# openstack hypervisor... (4 Replies)
Discussion started by: sand1234
4 Replies
2. Shell Programming and Scripting
Hi
How to pass echo output to a variable ?
Does below awk command will get the last character of hostname and assign to a variable - "svr" ?
svr=$( echo `hostname` | awk '{print substr($0,length,1)}' )
Thanks.
Please use CODE tags when dsplaying code segments, sample input, and sample... (7 Replies)
Discussion started by: Lim
7 Replies
3. Shell Programming and Scripting
I am reading lines from a file that contain a number sign (#) before a three or four digit number:
#1043
#677
I can remove the '#' and get just the number. However, I then want to assign that number to a variable and use it as part of a path further on in my program:
/mydir/10/1043 for... (5 Replies)
Discussion started by: KathyB148
5 Replies
4. Shell Programming and Scripting
Hello,
I am using below code for reading from a file and assigning the values to a variable , but it is loosing the value after the loop , please suggest to retain the value of the variable after the loop ,
while IFS=: read -r line
do
set $dsc=$line
echo 'printing line variable ' $line... (1 Reply)
Discussion started by: ParthThakkar
1 Replies
5. Shell Programming and Scripting
I see a millioin ways to do this with echo, but what I wan to do is assign a variable the "nth" character of an incoming parameter to a ksh script.
$1 will be "pia"
I need to assign the first character to stmttype. (10 Replies)
Discussion started by: klarue
10 Replies
6. Shell Programming and Scripting
Hi all,
I want write a csh script which must be able:
1.read a file
2.assign value in file as variable
and can i use read in csh script?
thx (2 Replies)
Discussion started by: proghack
2 Replies
7. Shell Programming and Scripting
I have a csv file with the values seperated by commas.I want to extract these values one by one and assign to a variable using shell script.Any ideas or code? (11 Replies)
Discussion started by: rajbal
11 Replies
8. Shell Programming and Scripting
i have a file in this format
curyymm PRVYYMM CDDMmmYY bddMmmyy eddMmmyy
--------- ------- ------------ ---------- -----------
0906 0905 09Jun09 01Jun09 30Jun09
----------- --------- ------------ ------------ -----------
i need to read the... (5 Replies)
Discussion started by: depakjan
5 Replies
9. UNIX for Dummies Questions & Answers
im having trouble doing this:
i have a variable with 2 characters repeating e.g. aababbbaaaababaabbaabbba
is there a way i can search the variable for a's and b's and then change a's to b's and b's to a's?
im guessing its like getting the 1's compliment of the string
im doing this in... (2 Replies)
Discussion started by: vipervenom25
2 Replies
10. UNIX for Dummies Questions & Answers
I have removeConfig file, it contains the dir paths for removing. I need to read line by line and assign to variable. any idea? (1 Reply)
Discussion started by: redlotus72
1 Replies