Closed swiatecki closed 8 years ago
Thank you for pointing out this error. However, the solution you propose is not clean either since both depend on the number of spaces between the fields. Very error prone. Nevertheless i am grateful for your tip. I will replace it with something like: date | awk '{print $NF}'
I agree it is error prone indeed, I would suggest "date +%Y"
Yes, this is even better ... how hard can it be.
I have followed your suggestion. Again, thank you for pointing this out.
Changed cut field parameter to 6, as -f 7 returns nothing.
root@lorank8:~/lorank8v1# date Sat May 14 10:10:04 UTC 2016 root@lorank8:~/lorank8v1# date | cut -d ' ' -f 7
root@lorank8:~/lorank8v1# date | cut -d ' ' -f 6 2016 root@lorank8:~/lorank8v1#