how do you read the last line in php and parse out certain columns

后端 未结 3 479
小蘑菇
小蘑菇 2021-01-27 12:02

I am very new to php. I\'d really appreciate all the help here.

I am using sftp to login to a server and get a file. I am only interested in the last line in that file.

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-27 13:08

    Why use php?

    With input file:

    7   1   0   59422170     306669 20188 20386     0     0 39787  59981  2014  67796 48953  2  7 90  1  1.81  11.3 12:19:50
    

    and command line:

    tail -n1 myfile | sed 's/\s\s*/ /g' | cut -d' ' -f15,16,19,20,21
    

    result is:

    2 7 1.81 11.3 12:19:50
    

提交回复
热议问题