Augabe Zeilen cat in Array

lundi 26 octobre 2015

Hallo!

Ich lasse mit eine Logdatei mit cat und awk so filtern, dass ich nur die Datum Strings der Dateie habe
Code:

cat tmp.log | awk -v count=$COUNT 'NR>=4 && NR<count'| awk '{print $6" "$7" "$8}'
ergibt
Code:

Oct 26 10:40
Oct 26 10:41
Oct 26 10:42

Nun möchte ich gern, dass ich diese Ausgabe in ein Array packe in der Form
Code:

$array={"Oct 26 10:40","Oct 26 10:41","Oct 26 10:42"}
Mein Versuch mit
Code:

$array=($(cat tmp.log | awk -v count=$COUNT 'NR>=4 && NR<count'| awk '{print $6" "$7" "$8}'))
ergibt aber ein Array
Code:

$array={"Oct","26", "10:40","Oct"..}
wie mappe ich die Zeilen in ein Array?

VG niesel


0 commentaires:

Enregistrer un commentaire

 

Lorem

Ipsum

Dolor