How do I use output from awk in another command?
问题 So I need to convert a date to a different format. With a bash pipeline, I'm taking the date from the last console login, and pulling the relevant bits out with awk, like so: last $USER | grep console | head -1 | awk '{print $4, $5}' Which outputs: Aug 08 ($4=Aug $5=08, in this case.) Now, I want to take 'Aug 08' and put it into a date command to change the format to a numerical date. Which would look something like this: date -j -f %b\ %d Aug\ 08 +%m-%d Outputs: 08-08 The question I have is,