1826312 Members
4395 Online
109692 Solutions
New Discussion

Re: script

 
Senthil Prabu.S_1
Trusted Contributor

script

Hi all,
I have a file with following datas;

backup:ce1
core:ce3
backup:ce5
core:ce7

Now, I want to operate on this file, so that my script prints a ouptut like
backup : ce1 :ce5
core: ce3 : ce7

Can anyone help me with this...


Thanks,
Senthil
One man's "magic" is another man's engineering. "Supernatural" is a null word.
2 REPLIES 2
Senthil Prabu.S_1
Trusted Contributor

Re: script

Hi all,
I got the answer.

It is;
sort group | awk -F: '{ if ( $1 == last ) { print ":"$2;} else { printf $0; } last=$1;}'
backup:ce1:ce5
core:ce3:ce7



so, closing the thread
One man's "magic" is another man's engineering. "Supernatural" is a null word.
Senthil Prabu.S_1
Trusted Contributor

Re: script

I found ans, so closing
One man's "magic" is another man's engineering. "Supernatural" is a null word.