I use last | grep pts/ to check who login my raspberry Pi:
samuelli pts/2 localhost Fri Apr 24 19:51 still logged in
pi pts/1 localhost Fri Apr 24 19:50 - 19:53 (00:03)
liuly pts/1 localhost Fri Apr 24 19:50 - 19:50 (00:00)
Now I want to extract the user name like pi and their login time like Fri Apr 24 19:51 and output username and time into a file. How could I to write this script ? Using cut ?
cutis that it doesn't handle variable amounts of spaces well. Check outawkinstead.