Quantcast
Channel: How to strip uncommon parts of filenames and have the unique parts - Ask Ubuntu
Browsing latest articles
Browse All 4 View Live

Answer by Sergiy Kolodyazhnyy for How to strip uncommon parts of filenames...

Perl solution We can use Perl to extract the wanted part before -201 substring, and store items into a hash, where each extracted string will be a key value. $ perl -ne...

View Article



Answer by heemayl for How to strip uncommon parts of filenames and have the...

Considering any possible filename, from that directory: printf '%s\0' cpu-*-201* | \ awk -F'-' 'BEGIN{RS="\0"} $3~/^201/ {a[$1"-"$2]} END{for(i in a) print i}' printf '%s\0' cpu-*-201* prints the...

View Article

Answer by steeldriver for How to strip uncommon parts of filenames and have...

I won't say this is "the optimal solution", but given $ ls cpu* cpu-interrupt-2016-05-07 cpu-softirq-2017-05-06 cpu-softirq-2017-05-08 cpu-system-2017-05-08 cpu-wait-2017-05-07 cpu-interrupt-2017-05-08...

View Article

How to strip uncommon parts of filenames and have the unique parts

Here is the file names I have; cpu-system-2016-05-06 cpu-system-2017-05-08 cpu-wait-2017-05-08 cpu-wait-2016-05-06 cpu-wait-2017-05-07 cpu-interrupt-2017-05-08 cpu-interrupt-2016-05-07...

View Article
Browsing latest articles
Browse All 4 View Live




Latest Images