![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Rules & FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| UNIX command: mv - Objective: move files based on timestamp | HLee1981 | UNIX for Dummies Questions & Answers | 4 | 07-11-2008 10:02 AM |
| Find, make and move file based on username | Helmi | UNIX for Dummies Questions & Answers | 5 | 04-19-2007 06:49 PM |
| Script for tar and zip based on month & year | tuxfello | Shell Programming and Scripting | 1 | 09-07-2006 08:52 AM |
| how to move files into different folders based on filename | italia5 | UNIX for Dummies Questions & Answers | 7 | 08-23-2006 07:04 AM |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
How do you move lines of numbers based on the month
How do you move lines of numbers i.e.(131, 134, 116, etc...) based on the month? Say for instance I only wanted June numbers and not July. This is what the file looks like so far but it runs everyday in a cron job so it will build to July.
#cat backupcount.log 131 ,Thu Jun 05 08:00:41 2008 134 ,Fri Jun 06 09:41:39 2008 116 ,Sat Jun 07 08:15:24 2008 106 ,Sun Jun 08 08:15:23 2008 95 ,Mon Jun 09 08:15:23 2008 117 ,Tue Jun 10 08:15:42 2008 140 ,Wed Jun 11 08:15:37 2008 I guess my problem is how do you move or copy based on the month. I thought about -mtime in relation to +30 days but some months have 28 and 31 days. How can I differentiate based on the month? |
| Forum Sponsor | ||
|
|
|
|||
|
Here's an easy solution:
Code:
grep " Jun " backupcount.log > June.stuff Code:
grep -v " Jun " backupcount.log > tmpfile.without.June mv tmpfile.without.June backupcount.log -mschwage |
|
|||
|
What I am trying to do is calculate all the numbers from the first field at the end of the month for a grand total of the month that just passed. Say for instance all of June on the 1st of July. I know I could just grab those numbers in stick them into excel but I know there is a way to do it on the command line .
|
| Tags |
| mtime |
| Thread Tools | |
| Display Modes | |
|
|