<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html; charset=ISO-8859-1"
 http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
<tt>Takes me back to my Unix days, when I concocted all sorts of weird
things like this to automate the integrated processing of data coming
unreliably from a wide range of plant sensors, and feeding back to fine
tune the process. (If you have a reasonable recent reading use it, but
if not, ignore for now, or look back to a previous similar situation
....)  Must come to meeting, but alas not next Thursday, unless quite
late, but I have a 6.00am flight out of Liverpool Friday morning. 
Roger.</tt><br>
<br>
On 18/10/2010 21:49, Stuart Burns wrote:
<blockquote
 cite="mid:AANLkTinJk=HHgMFSBfGkRKEn=8P=YK6hozSySnBu9Lpj@mail.gmail.com"
 type="cite">Dave, you must be a bash Jedi!<br>
  <br>
It does work, and I can kind of trace how it works, but would you mind
explaining it a bit more ?<br>
  <br>
Cheers muchly. I owe you a beer, if your at the LUG next week ?<br>
  <br>
  <br>
  <div class="gmail_quote">On 18 October 2010 21:26, David Holden <span
 dir="ltr"><<a moz-do-not-send="true" href="mailto:dh@iucr.org">dh@iucr.org</a>></span>
wrote:<br>
  <blockquote class="gmail_quote"
 style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">Hi
Stuart,<br>
    <br>
 VERY quick hack but it may work, the grep allows # comments<br>
    <br>
    <br>
IFS=' ';<br>
    <br>
datfile="1.dat"<br>
    <br>
(<br>
cat $datfile | sort | grep -v \# | while read data<br>
do<br>
 data_array=(`echo "$data"`)<br>
 col1=${data_array[0]}<br>
 echo -n "$col1 "<br>
 cat $datfile  | sort  | grep "$col1" | awk '{print $2}' | tr '\n' ' '<br>
 echo ""<br>
done<br>
) | sort | uniq<br>
    <br>
    <br>
Dave.<br>
    <div>
    <div class="h5"><br>
    <br>
On 18/10/10 17:44, Stuart Burns wrote:<br>
> Hi everyone,<br>
><br>
> I am hoping someone can help me a bit here. I am creating a cript
that<br>
> deals with volume groups. However my bash skills fall short.<br>
><br>
> I have a file that looks like this<br>
><br>
> Vg955-01 /dev/diska1<br>
> Vg955-01 /dev/diska2<br>
> Vg978-01 /dev/disk45<br>
> Vg978-04 /dev/disk13<br>
><br>
> You get the picture.<br>
><br>
> Now what I am trying to do is get all the vg parts followed by the<br>
> constituent disks. Ie above should look like:<br>
><br>
> Vg955-01 /dev/disk1a /dev/diska2<br>
> Vg978-01 /dev/disk45<br>
> Vg978-04 /dev/disk13<br>
><br>
> I cant really think of an easy way to do it without resorting to
perl.<br>
> Can anyone help?<br>
><br>
> Regards<br>
><br>
> Stu<br>
><br>
    </div>
    </div>
> _______________________________________________<br>
> Chester mailing list<br>
> <a moz-do-not-send="true" href="mailto:Chester@mailman.lug.org.uk">Chester@mailman.lug.org.uk</a><br>
> <a moz-do-not-send="true"
 href="https://mailman.lug.org.uk/mailman/listinfo/chester"
 target="_blank">https://mailman.lug.org.uk/mailman/listinfo/chester</a><br>
><br>
    <font color="#888888"><br>
--<br>
Dr David Holden. (<a moz-do-not-send="true" href="mailto:dh@iucr.org">dh@iucr.org</a>)<br>
    <br>
_______________________________________________<br>
Chester mailing list<br>
    <a moz-do-not-send="true" href="mailto:Chester@mailman.lug.org.uk">Chester@mailman.lug.org.uk</a><br>
    <a moz-do-not-send="true"
 href="https://mailman.lug.org.uk/mailman/listinfo/chester"
 target="_blank">https://mailman.lug.org.uk/mailman/listinfo/chester</a><br>
    </font></blockquote>
  </div>
  <br>
  <br>
______________________________________________________________________<br>
This email has been scanned by the MessageLabs Email Security System.<br>
For more information please visit <a class="moz-txt-link-freetext" href="http://www.messagelabs.com/email">http://www.messagelabs.com/email</a> <br>
______________________________________________________________________<br>
  <pre wrap="">
<fieldset class="mimeAttachmentHeader"></fieldset>
_______________________________________________
Chester mailing list
<a class="moz-txt-link-abbreviated" href="mailto:Chester@mailman.lug.org.uk">Chester@mailman.lug.org.uk</a>
<a class="moz-txt-link-freetext" href="https://mailman.lug.org.uk/mailman/listinfo/chester">https://mailman.lug.org.uk/mailman/listinfo/chester</a>
  </pre>
</blockquote>
</body>
</html>