10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I write this bit of code to calculate the mean and variance for all the files in one directory and print the mean and variance in a separate folder but with the same file name.
FILES="data/*"
for X in $FILES
do
name=$(basename $X)
awk '{x=$0; s+=$0; n++}
END{mean=s/n; for (i in x){ss... (20 Replies)
Discussion started by: A-V
20 Replies
2. UNIX Desktop Questions & Answers
Hi Friends,
I have two files as input with data that looks like this:
file1.txt
1
2
3
4
file2.txt
a,aa
b,bb
c,cc
d,dd
e,ee
f,ff
instead of me doing 2 while loops to get the combinations
while read line_file1 (2 Replies)
Discussion started by: kokoro
2 Replies
3. Shell Programming and Scripting
Hi...
I need a help in using the awk command or any other solution to avoid the usage of loops.
My question is :
I have a input like this :
field1|field2|field3|field4|field5|field6|field7|field8|field9
ex : 4000|testing|scenario|14450|500|320|450|200|100
where the... (2 Replies)
Discussion started by: vijayarajvp
2 Replies
4. UNIX for Dummies Questions & Answers
Hi, I need some help to figure out why an outer for loop KSH variable does not decode in AWK but inner for loop does. Below is my code,
If I hard code variable 'SUBSEQ' in AWK it works but if I try to pass the SUBSEQ from KSH, it does not and when I pass the variable 'NAM' from KSH it works: I... (1 Reply)
Discussion started by: chowdhut
1 Replies
5. Shell Programming and Scripting
hi All,
I have the following two requirements:
case 1:
In a file i have the below code:
if ((a>b)) a=b;
else a = c;
by using some means i need to convert the line to the following output:
Output required:
case 2:
In a file i have the below code:
if (a>b)
a=b;
else
a... (4 Replies)
Discussion started by: engineer
4 Replies
6. Shell Programming and Scripting
Hello - is there any way in awk I can do...
4861 x(1) y(1) z(1)
4959 x(1) y(1) z(1)
5007 x(1) y(1) z(1)
4861 x(2) y(2) z(2)
4959 x(2) y(2) z(2)
5007 x(2) y(2) z(2)
4861 x(3) y(3) z(3)
4959 x(3) y(3) z(3)
5007 x(3) y(3) z(3)
to become...
4861 x(1) y(1) z(1) 4861 x(2) y(2) z(2)... (3 Replies)
Discussion started by: catwoman
3 Replies
7. Shell Programming and Scripting
#!/bin/bash
IFS=$'\n'
A= a c b t g j i e d
B= t y u i o p
counter=0
found=""
for i in $(cat $A)
do
for j in $(cat $B)
do
if
then
found="yes"
fi
done
if
then (1 Reply)
Discussion started by: vadharah
1 Replies
8. UNIX for Dummies Questions & Answers
Hi,
how can I use "for" to have two loops :
this is my script :
for i in (A B C)
do
for j in (a b c)
do
echo $i$j
done
done
#End
I want to print out
Aa
Ab
Ac ....
But I have error message :
syntax error at line 1 : `(' unexpected
Many thanks before.
How should I use "for" ?? (2 Replies)
Discussion started by: big123456
2 Replies
9. Shell Programming and Scripting
ok, i tried to write a script called purge.sh
which searches current process' for a specified user running a process with a specified keyword. it also prompts the user to see how many times to purge for the specified process and how many different processes they wish to do this to.it worked until... (11 Replies)
Discussion started by: Blip
11 Replies
10. UNIX for Dummies Questions & Answers
Hi all,
I am an amateur k shell scripter and came across something I need clarification on.
while ; do
various commands
done
What is the "" condition testing for in the above while loop?
THx,
Bookoo (5 Replies)
Discussion started by: bookoo
5 Replies