I've got a peace of large text file with readings like below,name=ABCclass=3age=7roll_no=41 name=XYZclass=4age=9roll_no=23 So, how can I separate each name with their respective age and write the result in a single line, values separated by a space, like thisABC 3XYZ 9Is there any tool/script to save the result in JSON format ?Tried hours with awk, sed, tr, grep etc. etc. but I'm horrible at command line text processing, thanks in advance.
Separate two values from a large of text, while each of readings separated by a blank line
text processing;command line;json
I'd use awk:awk -F= '    {data[$1] = $2}     function output() {        if (name in data && age in data)             print data[name], data[age]        delete data    }    NF == 0 {output()}     END     {output()}' filename