The UNIX and Linux Forums  

Go Back   Die UNIX-und Linux-Foren > Top Foren > Shell Programmierung und Scripting
.
Google unix.com



Shell Programmierung und Scripting Post Fragen zu ksh, csh, sh, bash, Perl, PHP, sed, awk und anderen Shell-Skripte und Shell-Scripting-Sprachen hier.

Mehr UNIX-und Linux-Forum Themen Vielleicht finden Sie hilfreiche
Faden Thread Starter Forum Antworten Last Post
Konvertieren Epoche Zeit zur Standard-Datum und Zeit & Vice Versa DrivesMeCrazy Shell Programmierung und Scripting 5 02-07-2009 01:40 AM
Multi-Format zu konvertieren Datei in eine lesbare ASCII-Format gaur.deepti UNIX for Dummies Questions & Answers 5 03-25-2008 03:03 PM
MMTTJJ Datum-Format konvertieren, um ccyyddd-Format? Bhups Shell Programmierung und Scripting 2 09-28-2006 12:30 AM
Wie man Zeit zu Zeit readible-Format? cin2000 Shell Programmierung und Scripting 11 12-19-2005 07:14 PM
Format Datum / Uhrzeit Präsentation apalex Shell Programmierung und Scripting 6 04-19-2002 02:34 PM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Suche diesen Thread Rate Thread Anzeige-Modi
  #1 (permalink)  
Old 11-18-2008
rk4k rk4k is offline
Registrierte Nutzer
  
 

Join Date: Nov 2008
Location: / planet-earth/indonesia/jakarta /
Beiträge: 11
Talking Konvertieren Epoche / Uhrzeit-Format auf normalen Datum / Uhrzeit-Format in der gleichen Datei

Ich habe eine Datei mit dem Namen "Verdacht"-Serie mit der Zeile wie diese:


Code:
{'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '219.78.120.166', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 8291, 'time': 1226506312L, 'serverhostname': ''}
{'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '87.204.76.129', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 15485, 'time': 1226506312L, 'serverhostname': ''}
{'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '118.125.238.96', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 23786, 'time': 1226506312L, 'serverhostname': ''}
{'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '90.4.40.186', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 27542, 'time': 1226506312L, 'serverhostname': ''}
{'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '84.90.16.109', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 64115, 'time': 1226506312L, 'serverhostname': ''}
{'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '78.106.166.60', 'client_port': 45309, 'client': '10.64.68.143', 'server_port': 57587, 'time': 1226506312L, 'serverhostname': ''}
{'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '218.161.75.90', 'client_port': 45309, 'client': '10.64.68.143', 'server_port': 14323, 'time': 1226506312L, 'serverhostname': ''}
{'protocol': 6, 'service': 'BitTorrent encrypted transfer', 'server': '208.53.147.63', 'client_port': 3647, 'client': '10.64.68.68', 'server_port': 31866, 'time': 1226534386L, 'serverhostname': ''}
{'protocol': 6, 'service': 'BitTorrent transfer', 'server': '87.120.14.250', 'client_port': 41607, 'client': '10.64.68.78', 'server_port': 22566, 'time': 1226534379L, 'serverhostname': ''}
{'protocol': 6, 'service': 'HTTP', 'server': '72.14.221.190', 'client_port': 51980, 'client': '10.64.68.68', 'server_port': 80, 'time': 1226880065L, 'serverhostname': ''}
{'protocol': 6, 'service': 'Undetermined', 'server': '92.97.199.57', 'client_port': 55456, 'client': '10.64.68.68', 'server_port': 25252, 'time': 1226880097L, 'serverhostname': ''}
{'protocol': 6, 'service': 'HTTP', 'server': '74.125.19.118', 'client_port': 54043, 'client': '10.64.68.68', 'server_port': 80, 'time': 1226880099L, 'serverhostname': ''}

Ich möchte, um das Feld, 1226506312L den normalen Tag-Format. Ich habe das Skript, um ihn mit Datum mit:


Code:
date -d '1970-01-01 '$1' seconds'

Ich möchte, dass die Datei zu konvertieren, damit es wie folgt aussehen:


Code:
{'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '84.90.16.109', 'client_port': 52044, 'client': '10.64.68.44', 'server_port': 64115, 'time': Wed Nov 12 16:11:52, 'serverhostname': ''}
{'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '78.106.166.60', 'client_port': 45309, 'client': '10.64.68.143', 'server_port': 57587, 'time': Wed Nov 12 16:11:52, 'serverhostname': ''}
{'protocol': 17, 'service': 'BitTorrent KRPC', 'server': '218.161.75.90', 'client_port': 45309, 'client': '10.64.68.143', 'server_port': 14323, 'time': Wed Nov 12 16:11:52, 'serverhostname': ''}
{'protocol': 6, 'service': 'BitTorrent encrypted transfer', 'server': '208.53.147.63', 'client_port': 3647, 'client': '10.64.68.68', 'server_port': 31866, 'time': Wed Nov 12 23:59:46 WIT 2008, 'serverhostname': ''}
{'protocol': 6, 'service': 'BitTorrent transfer', 'server': '87.120.14.250', 'client_port': 41607, 'client': '10.64.68.78', 'server_port': 22566, 'time': Wed Nov 12 23:59:46 WIT 2008, 'serverhostname': ''}
{'protocol': 6, 'service': 'HTTP', 'server': '72.14.221.190', 'client_port': 51980, 'client': '10.64.68.68', 'server_port': 80, 'time': Wed Nov 12 23:59:46 WIT 2008, 'serverhostname': ''}
{'protocol': 6, 'service': 'Undetermined', 'server': '92.97.199.57', 'client_port': 55456, 'client': '10.64.68.68', 'server_port': 25252, 'time': Wed Nov 12 23:59:46 WIT 2008, 'serverhostname': ''}
{'protocol': 6, 'service': 'HTTP', 'server': '74.125.19.118', 'client_port': 54043, 'client': '10.64.68.68', 'server_port': 80, 'time': Wed Nov 12 23:59:46 WIT 2008, 'serverhostname': ''}

Ich weiß ein wenig über awk, und kann es mit:


Code:
awk '{ print $7 }' FS="," suspected | awk '{ print $2 }' | cut -f1 -d"L" | while read line ; do sh datepoch $line ; done

aber das Drehbuch gerade erst konvertieren und Output-Feld.

Wie man auch Ersatz und das Datum in das Format auf die gleiche Datei?

Vielen Dank für jede Hilfe.

Grüße
 

Lesezeichen

Tags
awk, sed, Ersatz

Thread Tools Suche diesen Thread
Suche diesen Thread:

Erweiterte Suche
Anzeige-Modi Rate this thread
Rate this thread:

Forumregeln
Du möglicherweise nicht neue Themen
Du möglicherweise nicht nach Antworten
Du möglicherweise nicht post-Anlagen
Du möglicherweise nicht bearbeiten Sie Ihre Beiträge

BB-Code ist Auf
Smilies sind Auf
[IMG] Code Auf
HTML-Code ist Aus
Trackbacks sind Auf
Pingbacks sind Auf
Refbacks sind Auf




Alle Zeiten sind GMT -4. Es ist jetzt 10:21 PM.


Powered by: vBulletin, Copyright © 2000 - 2006, Jelsoft Enterprises Ltd. Sprachliche Übersetzungen Powered by .
vBCredits v1.4 Copyright © 2007 - 2008, PixelFX Studios
Die UNIX-und Linux-Foren Content © Copyright 1993-2009. Alle Rechte Reserved.Ad Management von RedTyger

Content Relevant URLs durch vBSEO 3.2.0