[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Epoch time konvertieren



On 2017-01-30 11:29:01 Chinatinte hacked into the keyboard:
> Hallo Liste,
> 
> ich habe ein 115 M grosses Logfile, dessen einzelnen Zeilen so
> strukturiert sind:
> 
> 0|/2/System/Library/CoreServices/ManagedClient.app/Contents/PlugIns/phd.profileDomainPlugin|187735|d/drwxr-xr-x|0|0|0|1472862950|1379204098|1383254649|1379204098
> 
> 
> 
> Die letzten vier Einträge sind jeweils ein Zeitstempel in Epoch-Time.
> 
> Ich versuche, diese Zeitstempel in Human Readable Time umzuwandeln.
> 
> date -d 1383256791 ist klar.
> 
> Aber: Wie schaffe ich es, dies in einem Rutsch zu machen? Als
> bash-Neuling bin ich hier um jeden Tip und Hinweis dankbar.

----8<------------------------------------------------------------------
cat ${FILE} |
while read LINE
do
  DATE08=$(echo "${LINE}" |cut -d "|" -f8  |date --rfc-822)
  DATE09=$(echo "${LINE}" |cut -d "|" -f9  |date --rfc-822)
  DATE10=$(echo "${LINE}" |cut -d "|" -f10 |date --rfc-822)
  DATE11=$(echo "${LINE}" |cut -d "|" -f11 |date --rfc-822)

  # hier machste was mit dem menschen lesbaren Datums

done
----8<------------------------------------------------------------------

> Rudolf

Gruesse

-- 
Michelle Konzack        ITSystems
GNU/Linux Developer     0033-6-61925193

Attachment: signature.asc
Description: Digital signature


Reply to: