I need to add pipes to the following line:
10.245.1.1 0027.e391.cfc0 6975
Required output:
10.245.1.1|0027.e391.cfc0|697|5
I have tried using sed but I am a mess with regexp. Any help is appreciated.
I need to add pipes to the following line:
10.245.1.1 0027.e391.cfc0 6975
Required output:
10.245.1.1|0027.e391.cfc0|697|5
I have tried using sed but I am a mess with regexp. Any help is appreciated.
I would recommend you to check out the gnu manual for regex stuff with sed https://www.gnu.org/software/sed/manual/html_node/Regular-Expressions.html
It's a very powerful tool.
The sed command you're asking for is echo '10.245.1.1 0027.e391.cfc0 6975' | sed 's/\([[:graph:]]*\)[[:blank:]]\+\([[:graph:]]*\)[[:blank:]]\+\([[:digit:]]*\)\([[:digit:]]\)/\1|\2|\3|\4/g'
For more information, visit the Link please