Ubuntu Pastebin

Paste from ioria at Mon, 2 Jan 2017 17:08:53 +0000

Download as text
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/bin/bash

echo "Insert file to parse, full path [e.g. /var/log/syslog] :"
read file
cp "$file" ./mylog

awk '{print $1,$2,$3}' mylog  > syslog2
while read line; 
  do date -u -d "$line" +"%s" ;
done < syslog2 > seconds
paste seconds mylog > newsys




echo "Insert start time [ e.g. Nov 8 07:08:42 ]"
read string1
echo "Insert end time:"
read string2
StartDate=$(date -u -d "$string1" +"%s")
FinalDate=$(date -u -d "$string2" +"%s")

while  [[ "$StartDate" -le "$FinalDate" ]]
do 
    cat newsys | tr -d '\000' | grep "$StartDate" 
    
    (( StartDate++ ))
done
Download as text