I created a fake "ioscan" which displays output like yours. the script is entirely awk. it'd probably be done better in shell, but i'm not certain which that is.
Code:
#!/usr/bin/awk -f
BEGIN {
listcmd = "ioscan -fuNC disk"
while ((listcmd | getline) > 0) {
if ($1 != "disk")
continue
wwidcmd="ioscan -P wwid -N -H " $3
while ((wwidcmd | getline wwidline) > 0) {
if (wwidline !~ /^disk/)
continue
n=split(wwidline, a, /[[:space:]]*/)
if (a[3] == $3) print $0,a[4]
}
close(wwidcmd)
}
}
produces output like this:
Code:
[mute@geek ~]$ ./script
disk 3 64000/0xfa00/0x0 esdisk CLAIMED DEVICE HP DG072A9BB7 0xd9ef341e08df0449ab6e28a6698b8ed1
disk 4 64000/0xfa00/0x1 esdisk CLAIMED DEVICE HP DG072A8B54 0xa3a7d748a36dfe2838c22cf71e79b25f
disk 5 64000/0xfa00/0x2 esdisk CLAIMED DEVICE HP DG072A8B54 0xeb955194471d1b877293b54ba7c12807
disk 7 64000/0xfa00/0x3 esdisk CLAIMED DEVICE TEAC DVD-ROM DW-224EV 0x17ed66ede9042c52d6570e66ea8c4112
disk 19 64000/0xfa00/0x9 esdisk CLAIMED DEVICE EMC SYMMETRIX 0x0e90354e6c63d4b66a9fe1e8191cd0d5
disk 20 64000/0xfa00/0xa esdisk CLAIMED DEVICE EMC SYMMETRIX 0x35c07d3d928df2c0196e46a6296c8768
disk 21 64000/0xfa00/0xb esdisk CLAIMED DEVICE EMC SYMMETRIX 0x2b6c01e7a6591d730234fd03c909d943
disk 22 64000/0xfa00/0xc esdisk CLAIMED DEVICE EMC SYMMETRIX 0xb403a1eb43fe26e4c5eadfc366554f29
disk 25 64000/0xfa00/0xd esdisk CLAIMED DEVICE EMC SYMMETRIX 0x0b4a30a946bdcc35812f341d52577148
disk 34 64000/0xfa00/0x10 esdisk CLAIMED DEVICE DGC CX500WDR5 0x83c9c360f1dd2b200c26d997bc5d19b6
disk 35 64000/0xfa00/0x11 esdisk CLAIMED DEVICE DGC CX500WDR5 0xa33398f2469a04d6e6666696c9494569
disk 41 64000/0xfa00/0x12 esdisk CLAIMED DEVICE EMC SYMMETRIX 0x71db7f9609f641977acc1c3efa74fa19
disk 42 64000/0xfa00/0x13 esdisk CLAIMED DEVICE EMC SYMMETRIX 0x0813fa24f883561fee832cbafd13ae41
disk 47 64000/0xfa00/0x19 esdisk CLAIMED DEVICE DGC CX500WDR5 0x31f43321710280c06969f2bf7092f452
disk 48 64000/0xfa00/0x1a esdisk CLAIMED DEVICE DGC CX500WDR5 0xf42a447b64f431b99d7fe59f65f71bc7
disk 49 64000/0xfa00/0x1b esdisk CLAIMED DEVICE DGC CX500WDR5 0x0e35417912095526b85ff927eeb3051d
disk 50 64000/0xfa00/0x1c esdisk CLAIMED DEVICE DGC CX500WDR5 0x9e5630af99c9c6441083ed4b152e8210
---------- Post updated at 01:18 PM ---------- Previous update was at 01:09 PM ----------
Ya know ioscan can probably be made to output all of this but I cannot find a proper manual page for it. I'm guessing here but also hoping -P could take multiple options so that you can have it display all the fields you want instead of just wwid ...
Can somebody give me the explanation for this command line:
ps>newfile<infile wc -l
?
I am totally confused with the order of its execution.. :confused:
Thanx,
Saneesh Joseph. (3 Replies)
Hi Group ,
I m trying to execute commands on some other system using write command but inspite of executing the commands they r passed as simple messages.
- i m writing
>write user-id
! ls
o
ctrl-d
inspite of executing the command ls,other terminal shows ! ls.
Thnx in advance. (2 Replies)
If I have a flat file date.txt separate by a tab
date1 date2 count
20060226 20060225 2
20060227 20060226 2
20060228 20060227 5
20060314 20060228 2
20060315 20060314 1
If $3 (count) is 5 then execute the script testit.ksh with... (13 Replies)
I'm trying to populate a command line into a variable. It appears to be executing, instead. Here's an example:
mycmd=''
if ...; then
$mycmd='sudo '
fi
$mycmd=$mycmd 'sed -i prev s/aaa/bbb/' $myfile
res=`$mycmd`
(I'm also not sure of the best way to execute the command from the... (1 Reply)
How to make it works this way?
echo dir1\/*.txt ; echo dir1\/*.html | xargs wc -l
dir1/*.txt
wc: dir1/*.html: No such file or directory
what i'm trying to do it to "wc dir1/*.txt" and "wc dir1/*.html" (2 Replies)
Hi All,
I need this to execute and not just print on Red Hat ent 4 bash shell.
cat /etc/passwd|grep db2 | awk -F":" '{print "cat /etc/group | grep ",$4}'
Output:
cat /etc/group | grep 1000 (I don't want this to print but execute)
Thanks for any comment you may add. (2 Replies)
HI,
I have a directory called input directory called "input", The "input" directory contains file names (file1,file2,file3,file4), I want to write a command so that it will display all the file names with comma separated.
Desired output: file1,file2,file3 so on....
Regards
Akshay... (2 Replies)
I am running the export command within a view to use that value inside my build script. But while executing it it is saying "export command not found"
My code is as follows:
--------------------------
#!/bin/sh
user="test"
DIR="/bldtmp/"$user
VIEW="test.view1"
echo "TMPDIR before export... (4 Replies)
Hello :)
new to bash not to programming.
I have an on-going need to change the owning group on sets of files and directories from the one they were created with or changed to on update to the one they need to have going forward.
find {target_root} -group wrong_group
gets me a newline... (4 Replies)
Hello i am having an issue with bash script and this is the code
now=$(cat hosts1.txt | awk '{print $2;}')
while read n ;do
ssh root@$now 'useradd test1; echo -e "test1\ntest1" | passwd test1 && echo "test1 ALL=(ALL:ALL) ALL" >> /etc/sudoers'
When i execute only part with cat, it... (8 Replies)
Discussion started by: tomislav91
8 Replies
LEARN ABOUT DEBIAN
scsi_stop
SCSI_STOP(8) SG3_UTILS SCSI_STOP(8)NAME
scsi_stop - stop (spin down) one or more SCSI disks
SYNOPSIS
scsi_stop [--help] [--verbose] [--wait] DEVICE [DEVICE]*
DESCRIPTION
This Bourne shell script calls the sg_start utility on each given DEVICE. The purpose is to spin down (stop) each given DEVICE.
OPTIONS
Arguments to long options are mandatory for short options as well.
-h, --help
print out the usage message then exit.
-v, --verbose
increase level or verbosity.
-w, --wait
wait for the spin down (stop) on each given DEVICE to complete. The default action is to do each stop in immediate mode.
NOTES
The sg_start utility calls the SCSI START STOP UNIT command and can either start (spin up) or stop (spin down) a SCSI disk depending on the
given command line options.
EXIT STATUS
The exit status of this script is 0 when it is successful. Otherwise the exit status is that of the last sg_start utility called. See the
sg3_utils(8) man page.
AUTHORS
Written by D. Gilbert
COPYRIGHT
Copyright (C) 2009 Douglas Gilbert
This software is distributed under a FreeBSD license. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PUR-
POSE.
SEE ALSO
sg_start (sg3_utils)
sg3_utils-1.28 August 2009 SCSI_STOP(8)