Hi
I am trying to print only a specific device using fdisk -l piped through grep. Specifically, I am looking to print only "/dev/sda1" However the entire line is printed including format and partition size. I want to cut off the rest of the line and only print the beginning of the line.
For example,
fdisk -l prints
Code:
Disk /dev/hdc: 60.0 GB, 60011642880 bytes
255 heads, 63 sectors/track, 7296 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x02670266
Device Boot Start End Blocks Id System
/dev/hdc1 * 1 5840 46909768+ 83 Linux
/dev/hdc2 5841 5948 867510 82 Linux swap
/dev/hdc3 5949 7296 10827810 83 Linux
Disk /dev/sda: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00073443
Device Boot Start End Blocks Id System
/dev/sda1 1 11917 95723271 c W95 FAT32 (LBA)
/dev/sda2 11918 37413 204796620 83 Linux
/dev/sda3 37414 108636 572098747+ f W95 Ext'd (LBA)
/dev/sda5 37414 62909 204796588+ c W95 FAT32 (LBA)
/dev/sda6 62910 75804 103579056 b W95 FAT32
fdisk -l | grep Linux| grep -w '/dev/sd..' prints the entire line
Quote:
/dev/sda2 11918 37413 204796620 83 Linux
|
How would I cut off the rest of the line and print only /dev/sda2 ?