filter a file in table

21 views Asked by At

this question is a follow up of a previous question entitled filter file content to sorted tables,I didn't get a satisfactory answers so I have added more explanation on how the results should looks like .

I have a file that contains the following lines of code. here the file displays a schedules which are sorted one by one .

at 12:00 the schedule of james version1 is :
first_task:eating:nothing
second_task:rest:onehour
third_task:watching:nothing 

at 12:00 the schedule of james version2 is :
first_task:eating:fruits
second_task:rest:twohour
third_task:watching:manga 

at 12:00 the schedule of alex version1 is :
first_task:eating:fruit
second_task:rest:halfhour
third_task:watching:horrorfilm 

at 12:00 the schedule of alex version2 is :
first_task:eating:meal
second_task:rest:nothing
third_task:watching:nothing 

at 18:00 the schedule of james version1 is :
first_task:eating:fastfood
second_task:rest:twohours
third_task:watching:series 

at 18:00 the schedule of james version2 is :
first_task:eating:nothing
second_task:rest:onehours
third_task:watching:series 

at 18:00 the schedule of alex version1 is :
first_task:eating:vegetals
second_task:rest:threehours
third_task:watching:manga 

at 18:00 the schedule of alex version2 is :
first_task:eating:bread
second_task:rest:fivehours
third_task:watching:manga 

at 22:00 the schedule of james version1 is :
first_task:eating:nothing
second_task:rest:sevenhours
third_task:watching:nothing

at 22:00 the schedule of james version2 is :
first_task:eating:meal
second_task:rest:sixnhours
third_task:watching:nothing

at 22:00 the schedule of alex version1 is :
first_task:eating:vegetals
second_task:rest:sevehours
third_task:watching:manga 

at 22:00 the schedule of alex version2 is :
first_task:eating:icecream
second_task:rest:sevenhours
third_task:watching:nothing 

I've tried to sort it this way :

12:00 eating:fruit
18:00 eating:vegetals
22:00 eating:nothing

12:00 rest:onhour 
18:00 rest:threehour
22:00 rest:sevenhour

12:00 watching:horrorfilm 
18:00 watching:manga
22:00 watching:nothing

using these commands :

awk -F '[\ :]' '/the schedule is/{h=$2;m=$3} /eating/{print " "h":"m" watching:"$3}' f.txt
awk -F '[\ :]' '/the schedule is/{h=$2;m=$3} /rest/{print " "h":"m" rest:"$3}' f.txt
awk -F '[\ :]' '/the schedule is/{h=$2;m=$3} /watching/{print " "h":"m" watching:"$3}' f.txt

Now I am looking to improve the filtered file by ignoring all non significant words and sorting the most valuable information in a table , I've tried to think/search how get this format but in vain .

James version1,12:00,18:00,22:00
eating,nothing,fastfood,nothing
rest,onehour,halfhour,sevenhours
watching,nothing,series,nothing

James version2,12:00,18:00,22:00
eating,fruits,nothing,meal
rest,twohour,onehours,sixnhours
watching,manga,series,nothing 

alex version1,12:00,18:00,22:00
eating,fruit,vegetals,vegetals
rest,halfhour,threehours,sevehours
watching,horrorfilm,manga,manga 

alex version2,12:00,18:00,22:00
eating,meal,bread,icecream
rest,nothing,fivehours,sevenhours
watching,nothing,manga,nothing
0

There are 0 answers