Tuesday 15 February 2011

regex - get file names, time stamps and MD5 checksums from a log file -


I want to write a bash script which will output a log file and extract the related content to another log file The use that I use to send a file as an example will be done for statistical analysis of the time:

The content is as follows:

  FileSize TimeStamp MD5 complete Path 4824597 to file 2013-06-21 11:26 5 A264 ... C11 ... 45 /.../.../Itam.xml 4824597 2013-06-20 23:18 5 A264 ... c 11 ... 48 / <../.../ 1447_rO8iKD.TMP.ITAM.xml   

In the timestamp and full path file

I am starting in the script, but so far I have tried:

  cat "/var/log/Customer.log" | Grep '2013 * 11 * & gt; & Gt; Test.txt   

What other methods do I remember? Many thanks

If you want to remove the timestamp and the absolute path for all entries, then this should work:

  awk 'NR & gt; 1 {Print $ 2, $ 3, $ NF} 'Input File & gt; Output file    

No comments:

Post a Comment