Let l have a file that contain a data like this:
-ab-a--a-- 1 abcd abcd 934M Nov 2 00:14 abc_de-123.456.xyz-2022-11-02_1234567890.zip
-ab-a--a-- 1 abcd abcd 45M Nov 2 01:39 abc_de-123.456.xyz-2022-11-02_1234567890.zip
-ab-a--a-- 1 abcd abcd 7.1G Nov 12 02:35 abc_de-123.456.xyz-2022-11-12_1234567890.zip
-ab-a--a-- 1 abcd abcd 1020M Nov 9 03:32 abc_de-123.456.xyz-2022-11-09_1234567890.zip
-ab-a--a-- 1 abcd abcd 1.1G Nov 12 04:32 abc_de-123.456.xyz-2022-11-12_1234567890.zip
-ab-a--a-- 1 abcd abcd 1010G Nov 7 05:35 abc_de-123.456.xyz-2022-11-07_1234567890.zip
-ab-a--a-- 1 abcd abcd 2.0G Nov 12 06:41 abc_de-123.456.xyz-2022-11-12_1234567890.zip
So how to store the time and zip file name in array from this file? There is different number of space in some rows.
I have tried this code:
readarray -t time_array <<< "cut -d ' ' -f 9 filename)"
readarray -t zip_array <<< "cut -d ' ' -f 10 filename)"
this code only works when there is equal number of < space > as a column separator but in the file there is not same number of space as a column seperator
I want the the output as:
time array contains:
00:14
01:39
02:35
03:32
04:32
05:35
06:41
and
zip_array contains:
abc_de-123.456.xyz-2022-11-02_1234567890.zip
abc_de-123.456.xyz-2022-11-02_1234567890.zip
abc_de-123.456.xyz-2022-11-12_1234567890.zip
abc_de-123.456.xyz-2022-11-09_1234567890.zip
abc_de-123.456.xyz-2022-11-12_1234567890.zip
abc_de-123.456.xyz-2022-11-07_1234567890.zip
abc_de-123.456.xyz-2022-11-12_1234567890.zip
awkwhere you can further manage the datals -l? If so, don't parselsoutput.