我用linux 的bash,有時輸出的stdout前面會有一些警告或其他不相關的資訊
譬如gdisk你有沒有GPT的輸出就會不一樣,但是我只要抓後面的分割表資訊
***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory.
***************************************************************
Warning! Secondary partition table overlaps the last partition by
33 blocks!
You will need to delete this partition or resize it in another utility.
Disk /dev/sda: 2930275055 sectors, 1.4 TiB
Logical sector size: 512 bytes
Disk identifier (GUID): B39B51E9-4599-4F74-93A2-294DF2860F14
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 2930275021
Partitions will be aligned on 8-sector boundaries
Total free space is 35699733 sectors (17.0 GiB)
Number Start (sector) End (sector) Size Code Name
1 63 1646699 804.0 MiB 8300 Linux filesystem
2 1690000 5450000 1.8 GiB 8300 Linux filesystem
3 5559999 11979999 3.1 GiB 8300 Linux filesystem
5 11999999 17187199 2.5 GiB 8300 Linux filesystem
6 17187299 19045799 907.5 MiB 8300 Linux filesystem
7 20000000 25329999 2.5 GiB 8300 Linux filesystem
也就是藍色部分。唯一的共通點我看就是在 紅色那行的下面。
我有想過抓數字開頭,但是綠色那行會被抓到。
雖然可能還可以加上空白解決這個案例的要求,
不過我想請問的是有沒有通用的,真的根據特定文字行當作一個tag當起點,
再從那邊開始擷取?