Home > OS >  Awk processing
Awk processing

Time:10-05

Cx digital hbase original text column 2 x is the column number of expected results, the value behind the value=https://bbs.csdn.net/topics/is expected results corresponding to the value of the column number by size of column number behind the value=value into a line of

02120 aa_merge_20190711_551_1000020250198 column=aa: c4, timestamp=1562935948187, value=https://bbs.csdn.net/topics/250
02120 aa_merge_20190711_551_1000020250198 column=aa: c5, timestamp=1562935948187, value=https://bbs.csdn.net/topics/20190519
02120 aa_merge_20190711_551_1000020250198 column=aa: c2, timestamp=1562935948187, value=https://bbs.csdn.net/topics/0
02120 aa_merge_20190711_551_1000020250198 column=aa: c3, timestamp=1562935948187, value=https://bbs.csdn.net/topics/551
02120 aa_merge_20190711_551_1000020250198 column=aa: c1, timestamp=1562935948187, value=https://bbs.csdn.net/topics/aa_MERGE_20190711_551_1000030
02120 aa_merge_20190711_551_1000020250201 column=aa: c1, timestamp=1562935948187, value=https://bbs.csdn.net/topics/aa_MERGE_20190711_551_1000020
02120 aa_merge_20190711_551_1000020250201 column=aa: c3, timestamp=1562935948187, value=https://bbs.csdn.net/topics/160
02120 aa_merge_20190711_551_1000020250201 column=aa: c4, timestamp=1562935948187, value=https://bbs.csdn.net/topics/167
02120 aa_merge_20190711_551_1000020250201 column=aa: c2, timestamp=1562935948187, value=https://bbs.csdn.net/topics/0558
02120 aa_merge_20190711_551_1000020250201 column=aa: c5, timestamp=1562935948187, value=https://bbs.csdn.net/topics/69


-- -- -- -- -- -- -- -- -- -- -- -- expected results -- -- -- -- -- -- -- -- -- -- -- -- -- --
Aa_MERGE_20190711_551_1000020 | 0558 | 160 | 167 | 69 | 02120 aa_merge_20190711_551_1000020250201
Aa_MERGE_20190711_551_1000030 | 0 551 | | 250 | 20190519 | 02120 aa_merge_20190711_551_1000020250198

CodePudding user response:

Don't know what you mean

CodePudding user response:

Recommend http://www.zsythink.net/archives/tag/awk

Good thing!

 
{
A [$1] [$2]=$4.
}

END {
For (a) in I {
For (k in a [I]) {
Out [I]=sprintf (" | "% s % s, out [I], gensub (/value=https://bbs.csdn.net/topics/(. +)/, \ " "1", "g", a [I] [k]));
}
}
For (I in out) {
Print (sprintf (" % s % s ", the out [I], I));
}
}
  • Related