10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Oracle Linux : 6.4/bash shell
In the below I want to break out of the loop when it enters the 5th iteration.
#!/bin/bash
for i in 1 2 3 4 5 6
do
echo "$i"
if
echo "Oh Nooo... i = $i. I need to stop the iteration and jump out of the loop"
then break
fi
done
But, it only... (3 Replies)
Discussion started by: John K
3 Replies
2. UNIX for Dummies Questions & Answers
Hi,
A basic sed question.
I have a set of files. In each file there is a number that I want replaced. For example, if I run sed I should get the following:
% cat test2.txt
#goofy//171.00
goofy 171.00
% sed -i 's/171/xxx/g' test2.txt
% cat test2.txt
#goofy//xxx.00
goofy xxx.00
... (2 Replies)
Discussion started by: pc2001
2 Replies
3. Shell Programming and Scripting
I'm obviously very new to this. I'm trying to write a simple for loop that will read the directory names in /Users and then copy a file into the same subdir in each user directory.
I have this, and it works but it isn't great.
#!/bin/bash
HOMEDIRS=/Users/*
for dirs in $HOMEDIRS; do
if ];... (5 Replies)
Discussion started by: Heath_T
5 Replies
4. Shell Programming and Scripting
OS : RHEL 6.1
Shell : Bash
I had a similair post on this a few weeks back. But I didn't explain my requirements clearly then. Hence starting a new thread now.
I have lots of files in /tmp/stage directory as show below.
I want to loop through each files to run a command on each file.
I... (8 Replies)
Discussion started by: kraljic
8 Replies
5. Shell Programming and Scripting
Dear mentors, I just need little explanation regarding for loop to give input to awk script
for file in `ls *.txt |sort -t"_" -k2n,2`; do
awk script $file
done
which sorts file in order, and will input one after another file in order to awk script
suppose if I have to input 2 or... (4 Replies)
Discussion started by: Akshay Hegde
4 Replies
6. Shell Programming and Scripting
Hi, I am trying to make a script to manage log. I want to write the name of the .gz I moved and the date :
for i in `ls $replog/*.gz`
do
echo " $i "
`echo $i date +%d:%m:%Y`
`echo $datee `>> $replog/mrnet.log
mv $i /var/log/vieux-logs
done
I need to echo... (10 Replies)
Discussion started by: Dabless
10 Replies
7. Shell Programming and Scripting
sorry for being dumb here, but is there a way my for loop can take an entire line of a file into consideration instead of each word in a line... ill explain
if i have a file like this
# cat list
serial: 23124
hostname: server1
and a script that does this
# cat list.sh
#!/bin/sh
... (6 Replies)
Discussion started by: hcclnoodles
6 Replies
8. Shell Programming and Scripting
Our small company, about 5 users, need a basic script that scans mapped network drives (example: drive b,c,d, e, and f) for hard drive usage. This needs to send a report to myself in any type of basic notepad format (easy to read and decipher) for drives that have reached 80% usage... any ideas? ... (1 Reply)
Discussion started by: jessessays
1 Replies
9. Programming
I am trying to write a program that will;
1) Show the message "Snoozing now...zzzz" on the screen for 5 seconds
2) Then in the same position show the message "The ALARM is going off now!" for 5 seconds
3) Repeat 1) then 2) infinitely until user presses Ctrl C
I can't make it work. Any hints... (17 Replies)
Discussion started by: enuenu
17 Replies
10. AIX
how to i find out the disk usage on a server.
say in windows examples its like C:/ D:/ and checking out the disk space.
how can i find in Unix.
can i just use df -k (3 Replies)
Discussion started by: karthikosu
3 Replies