 <pre><code>user=bob lastb $user -t $(date -d "$(last $user | head -n 1 | tr -s '[:space:]' '\t' | cut -f 4-7)" +%Y%m%d%H%M%S) </code></pre> <p>More readably</p> <pre><code> user=bob last_login=$(last $user | head -n 1 | tr -s '[:space:]' '\t' | cut -f 4-7) datetime=$(date -d "$last_login" +%Y%m%d%H%M%S) lastb $user -t $datetime </code></pre> <p>Note that my <code>last</code> output looks a little different from yours, with an extra field: adjust your <code>cut</code> columns accordingly</p> <pre><code>$ last glennj -n 1 glennj pts/7 :0 Sun Jul 20 19:01 still logged in wtmp begins Fri Jul 4 21:15:28 2014 </code></pre>