awk '{print $0}' 'MB-HorribleSed-Set01.txt' | sed ...

Just give MB-HorribleSed-Set01.txt as an argument to sed!

The first hostname is a mess of hexadecimal characters, but the script deciphers the other three nicely.

I wrote in my last post: "If you want the separator to be any string of at most n characters but possibly a different string between different fields, replace every \2 with [^[:xdigit:]]\{0,n\}". With n = 1, which is enough for the example you gave, and additionally removing the now useless second pair of parentheses, the substitution becomes:

s/.*\([[:xdigit:]]\{4\}\)[^[:xdigit:]]\{0,1\}\([[:xdigit:]]\{4\}\)[^[:xdigit:]]\{0,1\}\([[:xdigit:]]\{4\}\)[^[:xdigit:]]\{0,1\}\([[:xdigit:]]\{4\}\)[^[:xdigit:]]\{0,1\}\([[:xdigit:]]\{4\}\)[^[:xdigit:]]\{0,1\}\([[:xdigit:]]\{4\}\)[^[:xdigit:]]\{0,1\}\([[:xdigit:]]\{4\}\)[^[:xdigit:]]\{0,1\}\([[:xdigit:]]\{4\}\).*/\1:\2:\3:\4:\5:\6:\7:\8/

Reply via email to