10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
I am trying to read a input file which has two columns separated by space
Input file
server1 server2
server3 server4
server5 server6
When i execute the below while code it reads line by line and a and b variables are able to successfully fetch the values
while read a b
do
echo "$a"
echo... (5 Replies)
Discussion started by: chidori
5 Replies
2. Shell Programming and Scripting
i have variables RECIPIENTS_DEVL,RECIPIENTS_UACC,RECIPIENTS_PROD
i have a case statement to get the phase variable:
case ${WMD_UPHASE1} in
u) WMD_UPHASE4=UACC;;
i) WMD_UPHASE4=DEVL;;
p) WMD_UPHASE4=PROD;;
d) WMD_UPHASE4=DEVL;;
*) WMD_UPHASE4=DEVL;;
esac
I am unable to... (3 Replies)
Discussion started by: Arun Mishra
3 Replies
3. Shell Programming and Scripting
Hi, I was wondering if anyone could assist me for (what is probably) a very straightforward answer.
I have input files containing something like
File 1
Apples
Apples
Apples
Apples
File 2
Bananas
Bananas
Bananas
Bananas (4 Replies)
Discussion started by: hubleo
4 Replies
4. Shell Programming and Scripting
Hi,
I have this code:
cat file.txt | awk -F, 'NR==1{print $6","$8","$10","$20","$21","$19}' > file.tmp
VAR1=`cat file.tmp | cut -d "," -f1`
VAR2=`cat file.tmp | cut -d "," -f2`
VAR3=`cat file.tmp | cut -d "," -f3`;
VAR4=`cat file.tmp | cut -d "," -f4`;
VAR5=`cat... (1 Reply)
Discussion started by: Tr0cken
1 Replies
5. Shell Programming and Scripting
Hi! This might be a simple thing, but I'm struggling to assign values to variables from the file.
I've the following values stored in the file.. It consists of only two rows..
10
20
I want to assign the first row value to variable "n1" and the second row value to variable "n2"..
That is ... (3 Replies)
Discussion started by: abk07
3 Replies
6. Shell Programming and Scripting
Please help me to automatically assign the output of awk command to the variables cs3, cs4, cs5 and cs6 using a for loop. The below code is not working.
for i in 3 4 5 6
do
cs$i=`awk -F"|" 'BEGIN{sum=0}{sum=sum+$'$i'}END{printf("%d\n", sum)}' css`
done
echo $cs3 $cs4 $cs5 $cs6 (9 Replies)
Discussion started by: thulasidharan2k
9 Replies
7. Shell Programming and Scripting
How do I assign values to reference variables?
I am assigning a variable name to --> $user_var
Then I am trying to change its underlying variable value by
$((user_var))=$user_value .. its failing,,
Please let me know if there is a way to do this dynamically..
FileA.props... (5 Replies)
Discussion started by: kchinnam
5 Replies
8. Shell Programming and Scripting
Hi
I am new to shell scripting and i am preparing a script.
for now i am work on a sub part of it..but i am unable to make it work.
---
the test code that i am working on
--------------------------
IFS=""
Sample_eve=`psg proc_s | grep tY`
n=0
for line in $Sample_eve... (41 Replies)
Discussion started by: Anteus
41 Replies
9. Shell Programming and Scripting
I need to do something like this:
for i in 1 2 3 4 5; do
arr=$(awk 'NR="$i" { print $2 }' file_with_5_records)
done
That is, parse a file and assign values to an array in an ascending order relative to the number of record in the file that is being processed on each loop.
Is my... (2 Replies)
Discussion started by: fiori_musicali
2 Replies
10. Shell Programming and Scripting
Hi,
I have some problem in assigning values to variables: This is what Iam literally doing:
i=0
input=test
temp$i = $input
In the sense, I try to assign the value in the variable input (ie., test) to another variable temp0 (since i is assigned 0, temp$i is temp0). Seems simple, but I get... (3 Replies)
Discussion started by: mohanprabu
3 Replies