This is starting to get funny. This is what I sent to Bradley long ago:
     awk '$4 ~ /^sd.$/ { print $4 }' /proc/partitions

On Sun, Apr 17, 2011 at 6:10 PM, Chris Fischer <[email protected]> wrote:

> This is even a bit simpler...even better would be to have only one grep
> filter, but this works:
>
> awk '{print $4}' /proc/partitions | grep sd | grep -v [0-9]
>
>
> On 4/17/2011 4:45 PM, Chris Fischer wrote:
>
>> Or instead of doing a loop, just grep for what you want:
>>
>> cat /proc/partitions | awk '{print $4}' | grep sd[a-z] | grep -v [0-9]
>>
>>
>> Regards,
>>
>> Chris
>>
>> On 4/17/2011 2:54 PM, Bradley Willson wrote:
>>
>>> I want to isolate the drives in /proc/partitions (i.e. sda, sdb, etc.)
>>> for
>>> another task (something other than echo :) ) but my test either returns
>>> nothing or everything and the kitchen sink, depending on whether I use a
>>> !=
>>> or == comparator...
>>>
>>> for disk in `cat /proc/partitions | awk '{print $4}'|sed '1,2d'`
>>>
>>>>     do
>>>>         if [ $disk == sd[a-z] ] then
>>>>             echo $disk
>>>>         fi
>>>> done
>>>>
>>>
>>> I know the 'cat' line gives me the raw data I want, it's the filter below
>>> that's broken.  I know it has to be something painfully simple, they
>>> typically are.
>>>
>>> Any ideas?
>>>
>>> Thanks in advance!
>>>
>>>
>>
>> !DSPAM:4dab7baf298331738519133!
>>
>>
>>
>


-- 
Phil Hughes
[email protected]

Reply via email to