it is going to read line-by-line the modified output of "df". Each line is read into variable "output" so that you can process them. Therefore it'll be executed for each line of output.
I'm not sure the usefulness of grep /, as I imagine every mount-point starts with / anyway. I see much room for improvement in this code. probably you'd want grep -Ev '^Filesystem|tmpfs|cdrom'. you can simplify so much into the awk process.. since you're not doing anything for entries under the alert level, you can let awk filter that out. read can also split the lines into variables, so you won't have to do echo $output | awk ...
I need help in what to do with a bash script? I'm trying to run a command to output the data from a table and then insert it into commands. Looping for each row of data.
For example the output data from a table:
10 John house
20 Jane apt
30 Joe townhomeThen I need to take the output... (1 Reply)
If I run this command
networksetup -listallnetworkservices
I get the following output.
Ethernet
AirPort
*Parallels Host-Guest
*Parallels NAT
MY VPN
Ethernet 2
I want to make changes to only anything that contains the word "Ethernet" which I can do with grep.
But What I really need a... (6 Replies)
Hi Guys,
This is based on my question previously posted. :)
I have my shell script like this:
#!/usr/bin/sh
e_id=`sqlplus -s scott/tiger@DB<<eof
SET PAGESIZE 0 FEEDBACK OFF VERIFY OFF HEADING OFF ECHO OFF;
select emp_id from employee;
quit
... (1 Reply)
Hi,
Sorry I'm new to shell scripting..
my loop is as follows:
let i=0
for item in ${APPSARRAY}
do
#..some code to get a unique value called $result
let i=i+1
done
What I want to do is within the for loop, create a comma seperated list:
... (3 Replies)
Good morning!!
Im trying to ge tthe output in this for loop to be reversed.
#!/usr/bin/perl
$i = 1;
for($i != 0 ; $i < 11 ; $i++){
print "$i\n";
}
Ive tried changing the i++ to i--, but it makes the outputted numbers different also.
Thanks
bigben (4 Replies)
Hi
This is my script
$ cat ./openldap_test.sh
#!/bin/bash
for ldap_srv in 'testserver1' 'server2' 'server3' 'server4' 'testserver5' 'server6' 'server7' 'server8' 'server9' 'testserver10';
do
ldapsearch -LLL -x -H ldap://$ldap_srv '(cn=examplebox)' memberNisNetgroup > /dev/null
if ; then... (1 Reply)
Hi ,
I'm writing the for loop script in home directory and wanted to get the files from /etc/data directory.
#!/bin/ksh
file_nm="/etc/dat"
for test_data in $file_nm/fln*
do
echo "$test_data"
done
the code is executing successfully , but in the output it is showing
... (6 Replies)
Hey guys,
I am VERY new to linux scripting and was wondering if you could help me with the following:
essentially the use case is the following...a service crashes and a script must be executed to rerun 3000 entries one at a time....your options are to do each of those manually, 1 at a time... (6 Replies)
I'm very much a newbie and hence why this is going to be a stupid question.
I'm attempting to create a korn shell script that pulls zone file locations and includes the copy command in the output. What?
getzonedir.ksh
#!/bin/ksh
while read -r domain
do ls */*"$domain" > $dir1
echo "cp... (5 Replies)
Hi All,
i have below for loop of which i am trying to redirect output in a file:
for i in `/usr/sbin/ifconfig -a | awk '/flags/ {print $1}' | grep -v lo | sed 's/://g'`
do
ifconfig $i dhcp status
done >> /tmp/logfile
but instead the output is appearing as stdout on screen rather than... (12 Replies)
Discussion started by: omkar.jadhav
12 Replies
LEARN ABOUT CENTOS
igawk
IGAWK(1) Utility Commands IGAWK(1)NAME
igawk - gawk with include files
SYNOPSIS
igawk [ all gawk options ] -f program-file [ -- ] file ...
igawk [ all gawk options ] [ -- ] program-text file ...
DESCRIPTION
Igawk is a simple shell script that adds the ability to have ``include files'' to gawk(1).
AWK programs for igawk are the same as for gawk, except that, in addition, you may have lines like
@include getopt.awk
in your program to include the file getopt.awk from either the current directory or one of the other directories in the search path.
OPTIONS
See gawk(1) for a full description of the AWK language and the options that gawk supports.
EXAMPLES
cat << EOF > test.awk
@include getopt.awk
BEGIN {
while (getopt(ARGC, ARGV, "am:q") != -1)
...
}
EOF
igawk -f test.awk
SEE ALSO gawk(1)
Effective AWK Programming, Edition 1.0, published by the Free Software Foundation, 1995.
AUTHOR
Arnold Robbins (arnold@skeeve.com).
Free Software Foundation Nov 3 1999 IGAWK(1)