![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | 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 and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| awk and sed filtering | invinzin21 | Shell Programming and Scripting | 2 | 01-11-2008 03:56 AM |
| AIX and cron logs filtering ?: /etc/cronlog.conf, /var/adm/cron/log | Keith Johnson | AIX | 0 | 01-09-2008 08:32 PM |
| port filtering | ujjwalmohan | HP-UX | 0 | 11-26-2007 01:18 AM |
| awk filtering ? | varungupta | UNIX for Advanced & Expert Users | 4 | 09-17-2007 02:55 AM |
| Filtering out data ... | videsh77 | UNIX for Dummies Questions & Answers | 1 | 12-29-2004 04:59 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
filtering the logs
Hi,
We are using rsync for syncing remote directories. It is working great along with detailed logs. As the script cron'd and most of the times there're no files to sync we are getting lot of unnecessary log entries and we need to filter them to show only the log entries for the files transferred. Actual Log: (part of) 2008/04/08 21:43:17 [19631] .d..t.... 09/ 2008/04/08 21:43:17 [19631] sent 51 bytes received 26 bytes 1.86 bytes/sec 2008/04/08 21:43:17 [19631] total size is 0 speedup is 0.00 2008/04/08 21:44:49 [5672] building file list 2008/04/08 21:44:49 [5672] done 2008/04/08 21:44:49 [5672] .d..t.... 09/ 2008/04/08 21:44:49 [5672] sent 51 bytes received 26 bytes 1.86 bytes/sec 2008/04/08 21:44:49 [5672] total size is 0 speedup is 0.00 2008/04/08 21:46:49 [31047] building file list 2008/04/08 21:46:49 [31047] done 2008/04/08 21:46:49 [31047] .d..t.... 09/ 2008/04/08 21:46:49 [31047] <f+++++++ 09/file1.pdf 2008/04/08 21:46:49 [31047] sent 110 bytes received 48 bytes 3.81 bytes/sec 2008/04/08 21:46:49 [31047] total size is 0 speedup is 0.00 2008/04/08 21:48:49 [25274] building file list 2008/04/08 21:48:49 [25274] done 2008/04/08 21:48:49 [25274] .d..t.... 09/ 2008/04/08 21:48:49 [25274] sent 71 bytes received 26 bytes 2.40 bytes/sec 2008/04/08 21:48:49 [25274] total size is 0 speedup is 0.00 2008/04/08 21:50:49 [18829] building file list 2008/04/08 21:50:49 [18829] done 2008/04/08 21:50:49 [18829] .d..t.... 09/ 2008/04/08 21:50:49 [18829] sent 71 bytes received 26 bytes 2.34 bytes/sec I achieved the below by using grep: 2008/04/08 21:43:17 2008/04/08 21:43:17 09/ 2008/04/08 21:44:49 2008/04/08 21:44:49 09/ 2008/04/08 21:46:49 2008/04/08 21:46:49 09/ 2008/04/08 21:46:49 09/file1.pdf 2008/04/08 21:48:49 2008/04/08 21:48:49 09/ 2008/04/08 21:50:49 2008/04/08 21:50:49 09/ 2008/04/08 21:52:49 I need to get only the entries that have a filename (that was actually transferred) as below: 2008/04/08 21:46:49 09/file1.pdf Thanks Prvn |
|
||||
|
Code:
awk '$3 =~ /\/./' Last edited by era; 04-08-2008 at 03:12 PM.. Reason: $5 observation |
|
||||
|
Thank you for your replies.
files may or may not contain extensions. i found solution for this (sorry if did not provide you enough info.) and it is date1="09" grep "$date1/" 1.txt |grep -v "$date1/"$ Era - i am getting this below error with your solution. -sh-3.1# cat 1.txt |awk '$3 =~ /\/./' awk: $3 =~ /\/./ awk: ^ syntax error -sh-3.1# cat 1.txt |gawk '$3 =~ /\/./' gawk: $3 =~ /\/./ gawk: ^ syntax error Thanks Prvn |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|