<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: awk for lvcreate in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365066#M704243</link>
    <description>I think I was not too clear. There are around 22 VGs other than vgidx and I do not get the expected answer. Please be more clear.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
    <pubDate>Sat, 28 Aug 2004 01:30:01 GMT</pubDate>
    <dc:creator>Rasheed Tamton</dc:creator>
    <dc:date>2004-08-28T01:30:01Z</dc:date>
    <item>
      <title>awk for lvcreate</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365060#M704237</link>
      <description>I have a file like below:&lt;BR /&gt;I want to create a text file for creating LVs on the system using this file. It has two lines. The Record Separator starting with vg (e.g., vgidx). So each record is two lines.&lt;BR /&gt;&lt;BR /&gt;What I am looking for is that the output txt file should produce like this; using the first two lines of the file:&lt;BR /&gt;&lt;BR /&gt;lvcreate -L 4080 -n idx01_4g vgidx &lt;BR /&gt;&lt;BR /&gt;--------------&lt;BR /&gt;vgidx &lt;BR /&gt;idx01_4g 4080&lt;BR /&gt;vgidx   &lt;BR /&gt;idx02_4g 4080  &lt;BR /&gt;vgidx   &lt;BR /&gt;idx03_4g 4080  &lt;BR /&gt;vgidx   &lt;BR /&gt;idx04_4g 4080  &lt;BR /&gt;vgidx   &lt;BR /&gt;idx05_4g 4080  &lt;BR /&gt;vgidx   &lt;BR /&gt;idx06_4g 4080  &lt;BR /&gt;vgidx   &lt;BR /&gt;idx07_4g 4080  &lt;BR /&gt;---&lt;BR /&gt;Thanks&lt;BR /&gt;Rasheed.&lt;BR /&gt;</description>
      <pubDate>Wed, 25 Aug 2004 14:08:06 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365060#M704237</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2004-08-25T14:08:06Z</dc:date>
    </item>
    <item>
      <title>Re: awk for lvcreate</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365061#M704238</link>
      <description>If perl is ok then-&lt;BR /&gt; &lt;BR /&gt;perl -ne 'chomp; /^vg/ &amp;amp;&amp;amp; do { $vg=$0l } ; /^id/ &amp;amp;&amp;amp; do { ($id,$sz)=split(" ",$_); print "lvcreate -L $sz -n $id $vg\n"; }' inputfile&lt;BR /&gt; &lt;BR /&gt;HTH&lt;BR /&gt; &lt;BR /&gt;-- Rod Hills</description>
      <pubDate>Wed, 25 Aug 2004 14:19:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365061#M704238</guid>
      <dc:creator>Rodney Hills</dc:creator>
      <dc:date>2004-08-25T14:19:42Z</dc:date>
    </item>
    <item>
      <title>Re: awk for lvcreate</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365062#M704239</link>
      <description>Or use awk:&lt;BR /&gt;&lt;BR /&gt;cat input-file | awk '/^vg/ {VG=$1} /^id/ {print "lvcreate  -L 4080 -n " $1" "$2" "VG}' &amp;gt;output-file&lt;BR /&gt;&lt;BR /&gt;HTH,&lt;BR /&gt;Peter</description>
      <pubDate>Wed, 25 Aug 2004 14:34:20 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365062#M704239</guid>
      <dc:creator>Hoefnix</dc:creator>
      <dc:date>2004-08-25T14:34:20Z</dc:date>
    </item>
    <item>
      <title>Re: awk for lvcreate</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365063#M704240</link>
      <description>Sorry mist an item:&lt;BR /&gt;this will be the way:&lt;BR /&gt;cat input-file | awk '/^vg/ {VG=$1} /^id/ {print "lvcreate  -L "$2" -n " $1" "VG}' &amp;gt;output-file&lt;BR /&gt;&lt;BR /&gt;Sorry for the mistake,&lt;BR /&gt;Peter</description>
      <pubDate>Wed, 25 Aug 2004 14:36:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365063#M704240</guid>
      <dc:creator>Hoefnix</dc:creator>
      <dc:date>2004-08-25T14:36:51Z</dc:date>
    </item>
    <item>
      <title>Re: awk for lvcreate</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365064#M704241</link>
      <description>Hmmm.. I think there's a minor error in Pete's script.&lt;BR /&gt;&lt;BR /&gt;I think it should be:&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;cat input-file | awk '/^vg/ {VG=$1} /^id/ {print "lvcreate -L " $2 " -n " $1"  "&lt;BR /&gt;VG}' &amp;gt;output-file</description>
      <pubDate>Wed, 25 Aug 2004 14:40:09 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365064#M704241</guid>
      <dc:creator>Kent Ostby</dc:creator>
      <dc:date>2004-08-25T14:40:09Z</dc:date>
    </item>
    <item>
      <title>Re: awk for lvcreate</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365065#M704242</link>
      <description>Kent,&lt;BR /&gt;&lt;BR /&gt;You are right, I saw it myself and posted the correction just before you ;-)&lt;BR /&gt;&lt;BR /&gt;Regards,&lt;BR /&gt;Peter</description>
      <pubDate>Wed, 25 Aug 2004 14:46:02 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365065#M704242</guid>
      <dc:creator>Hoefnix</dc:creator>
      <dc:date>2004-08-25T14:46:02Z</dc:date>
    </item>
    <item>
      <title>Re: awk for lvcreate</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365066#M704243</link>
      <description>I think I was not too clear. There are around 22 VGs other than vgidx and I do not get the expected answer. Please be more clear.&lt;BR /&gt;&lt;BR /&gt;Thanks</description>
      <pubDate>Sat, 28 Aug 2004 01:30:01 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365066#M704243</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2004-08-28T01:30:01Z</dc:date>
    </item>
    <item>
      <title>Re: awk for lvcreate</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365067#M704244</link>
      <description>Sorry Rodney, I got some compilation errors with the Perl stuff. I could not test it on my system. Also I am still not comforatble with Perl.</description>
      <pubDate>Sat, 28 Aug 2004 02:03:40 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365067#M704244</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2004-08-28T02:03:40Z</dc:date>
    </item>
    <item>
      <title>Re: awk for lvcreate</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365068#M704245</link>
      <description>Rasheed,&lt;BR /&gt;&lt;BR /&gt;The awk examples above work with your given sample data.  If you have VGs and LVs that don't use the above naming convention you can try this:&lt;BR /&gt;&lt;BR /&gt;awk '{vg=$0; getline; print "lvcreate -L " $2 " -n " $1 " " vg}' test.txt&lt;BR /&gt;&lt;BR /&gt;I created a sample file with the following data:&lt;BR /&gt;1vgidx1&lt;BR /&gt;idx01_4g 4080&lt;BR /&gt;2vgidx2&lt;BR /&gt;idx02_4g 6120&lt;BR /&gt;3vgidx3&lt;BR /&gt;idx03_4g 8160&lt;BR /&gt;&lt;BR /&gt;And the output of the command above was:&lt;BR /&gt;$ awk '{vg=$0; getline; print "lvcreate -L " $2 " -n " $1 " " vg}' test.txt&lt;BR /&gt;lvcreate -L 4080 -n idx01_4g 1vgidx1&lt;BR /&gt;lvcreate -L 6120 -n idx02_4g 2vgidx2&lt;BR /&gt;lvcreate -L 8160 -n idx03_4g 3vgidx3&lt;BR /&gt;&lt;BR /&gt;This should work without worrying about the VG or LV starting characters.&lt;BR /&gt;&lt;BR /&gt;Jim</description>
      <pubDate>Sat, 28 Aug 2004 03:37:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365068#M704245</guid>
      <dc:creator>Jim Mallett</dc:creator>
      <dc:date>2004-08-28T03:37:47Z</dc:date>
    </item>
    <item>
      <title>Re: awk for lvcreate</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365069#M704246</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;no syntaxcheck, and no empty lines required !&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt; awk '{ VG=$1&lt;BR /&gt; getline&lt;BR /&gt; print "lvcreate -L " $2 " -n " $1 " " VG&lt;BR /&gt; }' infile&lt;BR /&gt;&lt;BR /&gt;lvcreate -L 4080 -n idx01_4g vgidx&lt;BR /&gt;lvcreate -L 4080 -n idx02_4g vgidx&lt;BR /&gt;lvcreate -L 4080 -n idx03_4g vgidx&lt;BR /&gt;lvcreate -L 4080 -n idx04_4g vgidx&lt;BR /&gt;lvcreate -L 4080 -n idx05_4g vgidx&lt;BR /&gt;lvcreate -L 4080 -n idx06_4g vgidx&lt;BR /&gt;lvcreate -L 4080 -n idx07_4g vgidx&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Trick is to store the VG-Name in VG and to read the next line and after that generate the output line.&lt;BR /&gt;&lt;BR /&gt;Hope this helps&lt;BR /&gt;Volker</description>
      <pubDate>Sat, 28 Aug 2004 03:39:41 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365069#M704246</guid>
      <dc:creator>Volker Borowski</dc:creator>
      <dc:date>2004-08-28T03:39:41Z</dc:date>
    </item>
    <item>
      <title>Re: awk for lvcreate</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365070#M704247</link>
      <description>Thank you Jim/Volker - perfectly correct. That was what I am looking for.</description>
      <pubDate>Sat, 28 Aug 2004 03:53:50 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365070#M704247</guid>
      <dc:creator>Rasheed Tamton</dc:creator>
      <dc:date>2004-08-28T03:53:50Z</dc:date>
    </item>
    <item>
      <title>Re: awk for lvcreate</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365071#M704248</link>
      <description>How would the script file work if your text file looked something like this:&lt;BR /&gt;&lt;BR /&gt;vg01&lt;BR /&gt;/data 34578&lt;BR /&gt;/data2 10245&lt;BR /&gt;/oracle 22000&lt;BR /&gt;vg02&lt;BR /&gt;/data3 10245&lt;BR /&gt;/data4 10245&lt;BR /&gt;&lt;BR /&gt;Thanks for everyone's assistance with this problem&lt;BR /&gt;</description>
      <pubDate>Thu, 27 Jan 2005 10:57:42 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/awk-for-lvcreate/m-p/3365071#M704248</guid>
      <dc:creator>Donald C Nelson</dc:creator>
      <dc:date>2005-01-27T10:57:42Z</dc:date>
    </item>
  </channel>
</rss>

