10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Say I have a for loop that parse through a file....Say it look for the colors red and blue in sections of the file. Say it find red before it find blue in the file.
Say I have two if statements in the for loop
Something like if blue is found print blue is my favorite color is the first if... (7 Replies)
Discussion started by: scj2012
7 Replies
2. Shell Programming and Scripting
Bash shell, variables i and rem are working fine in 2 separate for loops, but I'd like to consolidate them like this:
for && This gives syntax error on &&.
Thanks in advance for direction. (5 Replies)
Discussion started by: p1ne
5 Replies
3. Programming
In shell scripting, I can create a conditional statement based on the success or failure (exit status)of a command such as:
pinger()
{
ping -c 2 $remote_host >/dev/null 2>&1
ping_stat=$?
}
pinger
if ]; then
echo "blahblahblah"
exit 0
fi
how is this done using Python using... (3 Replies)
Discussion started by: metallica1973
3 Replies
4. UNIX for Dummies Questions & Answers
Hi ,
I have a script which has multiple awk and sed commands like below.
First one :-
find /root/src/ -name "*csv" -size 0 -exec rm {} \;
Second one: -
ls *SRE*.txt > SRT_TRAN.dat
rm *asr*.txt
Third one :-
find /root/src/ -name '*.csv' | while read FILENAME ;
do
awk... (2 Replies)
Discussion started by: shruthidwh
2 Replies
5. Shell Programming and Scripting
Hi Guys!
Anybody know how can I use a nawk or awk on a script and printing the NAME, SECTION (must be 410 or 411 or 414) and TOTAL COST of CLASS 1 and 3 combined must be greater than 50. See below desired output file.
input.txt:
NAME,CLASS,COST,SECTION
JOHN,1,10,410
JOHN,2,20,410... (2 Replies)
Discussion started by: pinpe
2 Replies
6. Shell Programming and Scripting
Hi
I am very new to Unix programming and shell scripting. I am trying t figure out how to write a little script that will output the number of directories. I can find the number of directories using ls -l | grep "^d" | wc -l I can not figure out how to do it so when I type the name... (8 Replies)
Discussion started by: Reddoug
8 Replies
7. Shell Programming and Scripting
HI Unix Gurus,
I have a number of SELECT count(*) statements in an input file and I want to execute it using a shell script but one by one using loop in script....
How can I do this..... (7 Replies)
Discussion started by: ustechie
7 Replies
8. Shell Programming and Scripting
Simple question. What's the difference (pros and cons) between these two:
if ; then
condition1
elif ; then
condition2
fi \
&& condition1 \
|| condition2Is the second method faster as the whole line gets loaded into memory? Just looking for some tips of when I should use... (2 Replies)
Discussion started by: victorbrca
2 Replies
9. Shell Programming and Scripting
Hi,
Actually i stored all validdisks in one array and corresponding partitions required for all individual disks in other array..
Example:
Validdisks=dsk2 dsk3 dsk5
ValidPartition=4 4 3
Now i have to create domain..
Domain creation can be done by below commands:
fs_setup -d... (1 Reply)
Discussion started by: mansa
1 Replies
10. Shell Programming and Scripting
How can I compare two decimal values within a function using Bash? Function fun2 isn't comparing the decimal values. Is there a way to do this using Bash or Korn?
#!/bin/bash
set -x
x=1
z=110
function fun1() { i=`bc << EOF 2>> /dev/null
scale=3
... (1 Reply)
Discussion started by: cstovall
1 Replies