Perl reading file, printing unique value from a column

后端 未结 3 1765
遥遥无期
遥遥无期 2021-01-24 13:09

I am new to perl, and i\'d like to achieve the following with perl.

I have a file which contain the following data:

/dev/hda1 /boot ext3 rw          


        
3条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-24 13:24

    perl -anE '$s{$F[2]}++ }{say for keys %s' file
    

    or

    perl -anE '$s{$_}++ or say for $F[2]' file
    

提交回复
热议问题