title: print two variables output within a same line using shell script
body: <p>This is my script</p>
  
  <pre><code>fdisk -l &gt; /tmp/fdisk.txt
  DISK_NAME=$(cat /tmp/fdisk.txt  | grep -w "Disk /dev" | awk '{print $2}' | cut -d ':' -f1)
  echo disk name are : $DISK_NAME
  DISK_SIZE=$(cat /tmp/fdisk.txt  | grep -w Disk |grep -v "identifier" | awk '{print $3}' )
  
  HEAD=$(cat /tmp/fdisk.txt | grep "heads" | awk '{print $1}')
  SECTOR=$(cat /tmp/fdisk.txt | grep -w "sectors/track" | awk '{print $3}')
  CYLINDER=$(cat /tmp/fdisk.txt | grep -w "cylinders" | awk '{print $5}')
  TOTAL=$( cat /tmp/fdisk.txt | grep -w "total" | awk '{print $8}')
  echo disk size are :  $DISK_SIZE
  echo Head are : $HEAD
  echo Sector are : $SECTOR
  echo Cylinder are : $CYLINDER
  echo Total are : $TOTAL
  </code></pre>
  
  <p>Ouput is :</p>
  
  <pre><code>Disk /dev/mapper/openstackvm00--vg-root doesn't contain a valid partition table
  Disk /dev/mapper/openstackvm00--vg-swap_1 doesn't contain a valid partition table
  
  disk name are : /dev/sda /dev/sdb /dev/sdc /dev/sdd /dev/mapper/openstackvm00--vg-root /dev/mapper/openstackvm00--vg-swap_1
  disk size are : 10.7 32.2 8589 10.7 40.5 1073
  Head are : 255 64 86 255 255 255
  Sector are : 63 51 1 63 63 63
  Cylinder are : 1305 19275 195083 1305 4928 130
  Total are : 20971520 62914560 16777216 20971520 79183872 2097152
  </code></pre>
  
  <p>In this output I dont want first two lines</p>
  
  <pre><code> Disk /dev/mapper/openstackvm00--vg-root doesn't contain a valid partition table
   Disk /dev/mapper/openstackvm00--vg-swap_1 doesn't contain a valid partition table
  </code></pre>
  
  <p>And I want output like this</p>
  
  <pre><code> Device Name  Size   Head Sector Cylinder Total
   /dev/sda      10    255     63     1305   20971520
   /dev/sdb      --    --      --      --     ---
   /dev/sdc       --   --     -- -    -- -     --
  </code></pre>
  
  <p>How can I get like this?</p>
  
  <p>fdisk -l output redirect into Fdisk.txt file output. cat /tmp/fdisk.txt file
        # cat /tmp/fdisk.txt </p>
  
  <pre><code>  Disk /dev/sda: 10.7 GB, 10737418240 bytes
    255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x0005b9c4
  
    Device Boot      Start         End      Blocks   Id  System
    /dev/sda1   *        2048      499711      248832   83  Linux
    /dev/sda2          501758    20969471    10233857    5  Extended
    /dev/sda5          501760    20969471    10233856   8e  Linux LVM
  
    Disk /dev/sdb: 32.2 GB, 32212254720 bytes
    64 heads, 51 sectors/track, 19275 cylinders, total 62914560 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xe3162587
  
    Device Boot      Start         End      Blocks   Id  System
    /dev/sdb1            2048    62914559    31456256   8e  Linux LVM
  
    Disk /dev/sdc: 8589 MB, 8589934592 bytes
    86 heads, 1 sectors/track, 195083 cylinders, total 16777216 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0xa4cdf171
  
    Device Boot      Start         End      Blocks   Id  System
    /dev/sdc1            2048    16777215     8387584   83  Linux
  
    Disk /dev/sdd: 10.7 GB, 10737418240 bytes
    255 heads, 63 sectors/track, 1305 cylinders, total 20971520 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x3632934a
  
    Device Boot      Start         End      Blocks   Id  System
    /dev/sdd1            2048    10487807     5242880   83  Linux
    /dev/sdd2        10487808    14682111     2097152   8e  Linux LVM
    /dev/sdd3        14682112    15706111      512000   83  Linux
    /dev/sdd4        15706112    15910911      102400   83  Linux
  
    Disk /dev/mapper/openstackvm00--vg-root: 40.5 GB, 40542142464 bytes
    255 heads, 63 sectors/track, 4928 cylinders, total 79183872 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
  
  
    Disk /dev/mapper/openstackvm00--vg-swap_1: 1073 MB, 1073741824 bytes
    255 heads, 63 sectors/track, 130 cylinders, total 2097152 sectors
    Units = sectors of 1 * 512 = 512 bytes
    Sector size (logical/physical): 512 bytes / 512 bytes
    I/O size (minimum/optimal): 512 bytes / 512 bytes
    Disk identifier: 0x00000000
  </code></pre>