Grep & Tar Linux Command for email on selected user

A. GREP

To grep the email by year and ouput its total email

ls –full-time | grep “2010\\-” | wc -l

To grep the email by year and month. ex 2010-01

ls –full-time | grep “2010\\-01\\-”

To grep the email by year, month and date. ex 2010-01-22

ls –full-time | grep “2010\\-01\\-22”

To grep the email by year, month, date and hour. ex 2010-01-22 10am

ls –full-time | grep “2010\\-01\\-22\\ 10”


B. TAR – backup

To Tar it with extension of .tar.gz

tar -cvzf 2010-04-27-18h.tar.gz `ls –full-time | grep “2010\\-04\\-27\\ 18” | awk ‘{print $9}’`
C. Untar

To Untar it, just go to the directory you want to extract it.

tar -xvf 2010-04-27-18h.tar.gz

Advertisements

Mag-iwan ng Tugon

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Baguhin )

Twitter picture

You are commenting using your Twitter account. Log Out / Baguhin )

Facebook photo

You are commenting using your Facebook account. Log Out / Baguhin )

Google+ photo

You are commenting using your Google+ account. Log Out / Baguhin )

Connecting to %s