10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I'm trying to automate part of a script which uses awk to grab out some lines of a log file based on certain fields matching. For example, my log file looks something like the following (but 1000s of lines):
1 Tom 123 abc 345
2 Dick 345 abc 678
3 Harry 567 abc 345
4 Tom 345 cde 345... (3 Replies)
Discussion started by: chrissycc
3 Replies
2. Shell Programming and Scripting
Hi, I have a variable which read the value from the lines, and if it is empty string (5 bytes), then I have to assign this variable to zero "0", it able to detect the data is empty by showing me the message "empty", but not able to assign it as zero.
WTHP=`echo "$file" | cut -c158-162`
if ]... (5 Replies)
Discussion started by: newbie2011
5 Replies
3. UNIX for Dummies Questions & Answers
In AIX, why is it variable VAR becomes true in the condition despite VAR was unassigned and not equal to 1?
In Linux, it was traced as an error as VAR is not declared as variable and expecting an integer as argument.
one.sh
VAR=1
if ; then
echo "One"
fi
if ; then
echo "Two"... (5 Replies)
Discussion started by: budz26
5 Replies
4. Shell Programming and Scripting
Hello
newbies question...
I just need a script able to launch a command when a condition is matched :
#!/bin/ksh
SIZ = 'cat /nurp/control.lst|wc -l'
if test "$SIZ" -gt 0
then
echo 1
else
echo 2
fi
but I receive errors messages
./t2: SIZ: not found
2
whats wrong ? (5 Replies)
Discussion started by: vdurieu
5 Replies
5. Shell Programming and Scripting
Please help me with this:
I need to compare two values in if condition in shell script but its goes always to else condition:
TIME_CHECK=PM
TIME-CLOCK=PM
if ; then
echo "You have access!"
else
echo "ACCESS DENIED!"
fi (5 Replies)
Discussion started by: aroragaurav.84
5 Replies
6. UNIX for Dummies Questions & Answers
Hello,
I have the following data set:
TRAIT DOSE
40 0.4
30 0.3
95 1.2
120 1.7
85 1.4
136 1.8
134 1.8
40 0.4
30 0.3
95 1.2
120 1.7
85 1.4
136 1.8
134 1.8
40 0.4
30 0.3
95 1.2 (2 Replies)
Discussion started by: wolf_blue
2 Replies
7. Shell Programming and Scripting
I haven't checked any installation script to see how this is done..
But I could not even do following simple task.
How do I Change existing variable value only when user enteres non-empty string. ?
#!/usr/bin/ksh
uid="scott"
# Assign new value user enters to uid, else leave it... (7 Replies)
Discussion started by: kchinnam
7 Replies
8. Shell Programming and Scripting
How can I use a variable that has the conditions for the if statement stored in it?
my test script
condition=" || || "
if "$condition"
then echo "true"
else echo "false"
fi
output
$ ./test2.sh
./test2.sh: line 3: || || : command not found
false (2 Replies)
Discussion started by: curlee2002
2 Replies
9. Shell Programming and Scripting
I want to look into a folder to see if there are any folders within it. If there are, I need to check inside each folder to see if it contains a .pdf file
So
If /myserver/myfolder/
contains a folder AND that folder conatins a .pdf file
do X
Else
do Z
I may have multiple folders and... (4 Replies)
Discussion started by: crowman
4 Replies
10. UNIX for Dummies Questions & Answers
hi all,
i want use the variable value as a new variable name. print output of new variable.
for i in COMPUTER1 COMPUTER2
do
flag_name=${i}_FLAG
eval ${flag_name}=123
echo $i'_FLAG'
done
output is
COMPUTER1_FLAG
COMPUTER2_FLAG
i need output as
123
123 (2 Replies)
Discussion started by: arvindng
2 Replies