regex help on unix df

前端 未结 7 1931
耶瑟儿~
耶瑟儿~ 2020-12-02 01:22

I need some help tweaking my code to look for another attribute in this unix df output:

Ex.

Filesystem     Size    Used   Avail Capacity         


        
7条回答
  •  忘掉有多难
    2020-12-02 01:54

    Have you tried simply splitting on whitespace and taking the 4th and 5th columns?

    my @cols = (split(/\s+/, $_));
    my $avail = $cols[3];
    my $cap   = $cols[4];
    

    (Fails if you have spaces in your device names of course...)

提交回复
热议问题