I want to prompt a user to cut from a 'last' command along with what columns to cut. I also want to use 'tr' to fix all the difference in white spaces. This is the code I have:
echo -n "What rows and columns would you like to cut: "
read num_int
read num_row
read num_list
last $num_int
cut -f $num_row
tr -d $num_list
When I run it from the command line I get the prompt, so I hit enter then put in a number to cut. I then hit enter again and I get a list of info that prints to screen but doesn't break out of the executed script. Is there a better way to set this script up? Here's some sample data of what it echo's out to the screen:
slater pts/2 78.189.121.247 Sat Sep 1 23:21 - 23:27 (00:05)
slater pts/3 77.189.121.247 Sat Sep 1 23:09 - 23:21 (00:12)
slater pts/2 76.189.121.247 Sat Sep 1 22:59 - 23:09 (00:10)
slater pts/2 74.189.121.247 Sat Sep 1 22:51 - 22:56 (00:05)
pint pts/2 74.189.121.247 Sat Sep 1 22:49 - 22:51 (00:01)
terry pts/2 74-119-247-134.r Sat Sep 1 19:08 - 19:09 (00:00)