Well, what I am doing is getting the disk size, and then setting it to a variable "$SIZE". Would the extra space work in that case?
Here is the code:
Code:
## Find your disk sizes available for use.
for i in `vxdisk -o alldgs list | grep -v -e DEVICE -e LVM -e invalid -e dg | awk '{print $1}'`
do
grep $i inq.fil | grep $DISKTYPE | awk -F ":" '{print $11}'
done | uniq -d > sizes.txt
TOTAL=`cat sizes.txt | wc -l`
if [ $TOTAL -eq 0 ]
then
echo "There are no disks of this type available."
exit
else
continue
fi
## Present the sizes of the disks available.
print "Disk sizes that are available are:"
for i in `cat sizes.txt`
do
echo $i
done
## Choose what size disk(s) you want to use.
echo "What size disk do you want to use?"
print -n "Disk size? :"
read SIZE
## Capture the disk size you chose for use later.
echo $SIZE > sizes.size
function avail_disk_func
{
## Capture only the available disks of the type and size you want to use.
grep $DISKTYPE inq.fil | grep -v Copyright | grep $SIZE > $SIZE.txt
for i in `vxdisk -o alldgs list | grep -v -e DEVICE -e LVM -e invalid -e dg | awk '{print $1}'`
do
grep $i $SIZE.txt | grep $DISKTYPE | grep $SIZE
done > vxdisk_avail_$SIZE.txt
}
avail_disk_func
## Capture how many disks are available for use. If none, then exit.
TOTAL2=`cat vxdisk_avail_$SIZE.txt | wc -l`
if [ $TOTAL2 -eq 0 ]
then
echo "There are $TOTAL2 $DISKTYPE disks of this size available."
exit
else
continue
fi
echo
## How many disks do you want to use?
echo "There are $TOTAL2 $DISKTYPE disks of this size available."
echo
echo "How many do you want to use?"
print -n "to create your diskgroup? :"
read NUMBER
Here is what the inq.fil file read from at the beginning of the code looks like:
This script is only to be used when building NEW DISK GROUPS ONLY!!
that will be using VXVM 4.1 or higher to manage disks, with no rootdg.
This version has an option for striping, and lets you build multiple volumes
within the disk group(s) you create.
Have you ran the inq script?
Enter 'y' for Yes or 'n' for No :y
Chose the type of external storage
you will be working with. Your choices
are 'EMC' and 'EVA' (EVA = HSV).
Enter 'EMC' or 'EVA'. Disk type? :eva
Disk sizes that are available are:
524288000 <-- There are 11 of these
5242880 <-- There are 3 of these
What size disk do you want to use?
Disk size? :5242880 <-- This is the size I want. There are only 3
There are 14 HSV disks of this size available. <--Incorrect number reported.
How many do you want to use?
to create your diskgroup? :
Is there a way to grep for something and then print out 10 lines after it.
for example if I want to grep for a word, then output the following 10 or whatever number of lines after the word. (5 Replies)
Can you grep for a sentence. I have to search logs everyday at work and I was wondering if I could search for a string of words instead of just one.
for example, if I had to find this sentence:
"Received HTTP message type"
How would I grep it (2 Replies)
Using shell scripts, I use grep to find the word “error” in a log file:
grep error this.log.
How can I print or get the line 3 lines below the line that word “error” is located?
Thanks in advance for your response. (9 Replies)
Hi All,
I have a log file and I want to parse the logfile with a script.A sample text is shown below:
I would grep on "return code " on this file. Any idea how the lines above and below the grep patterns could also be extracted.
Thanks!
nua7
The runLoggingInstall return code is 0... (3 Replies)
I've got a script at the moment that looks like this:
if
then
echo "How many hours would you like users to have logged in for? (single digits)"
read hours
tim=
echo "These are the users who were logged in for $hours... (1 Reply)
I need to pass a parameter that will then be grepped.
I need it to grep /paramater and then have a space
so if 123 was passed my grep would be grep '/123 ' sample.log
this works fine from the command line
but when i try and set it searchThis="/$2 "
and then run grep $searchThis... (6 Replies)
Hi all,
Need your help here. I have a file with thousand of lines, as shown in example below
KDKJAA 98324
OIDSAJ 324
KJAJAK 100
KJKAJK 89
JOIJOI 21
JDKDJL 12
UOIUOD 10
UDUYDS 8
UIUHKK 6
I would like to grep using... (5 Replies)
I have a script to sort a list of arbitrary hosts and determine if they are supported by grepping them into a master supported list. I cut all the suffixes of the hosts in the arbitrary list, leaving the "short" hostname if you will, then grep -w them into the master list. For example:
... (1 Reply)
Dear Experts,
Need your help.
Typically we use "grep" to search and display a pattern in a txt file.
However, here what we want is, we want to grep a line which contains 4 words any where in a line.
For example.
File has 10,000,000 lines in it out of which there is a particular line which... (1 Reply)
I have around 300 files(*.rdf,*.fmb,*.pll,*.ctl,*.sh,*.sql,*.prog) which are of large size.
Around 8000 keywords(which will be in the file $keywordfile) needed to be searched inside those files.
If a keyword is found in a file..I have to insert the filename,extension,catagoery,keyword,occurrence... (8 Replies)