basics of using cut awk grep and sed...

Posted by Samantha on Stack Overflow See other posts from Stack Overflow or by Samantha
Published on 2010-02-08T21:03:05Z Indexed on 2010/03/13 21:55 UTC
Read the original article Hit count: 619

Filed under:
|

Hello there, I'm trying to extract the year from this output :

sam@sam-laptop:~/shell$ date
Mon Feb  8 21:57:00 CET 2010

sam@sam-laptop:~/shell$ date | cut -d' ' -f7
2010

sam@sam-laptop:~/shell$ date | awk '{print $6}'
2010

Are there any other ways to get the same result ? using maybe grep, sed etc ? Merci !

© Stack Overflow or respective owner

Related posts about bash

Related posts about shell