Greetings. I am using SED to cleanup files that are laid out like so:
ReceiverID=028936004663
SerialNumber=WD-WCAV95708405
Currenttemp=44C
PowerOnHours=3663h
ReceiverID=028923894902
SerialNumber=WD-WCAV9A766701
Currenttemp=49C
PowerOnHours=2215h
My boss wants files like this one to be tab ("\t") delimited like so
ReceiverID=...(tab)SerialNumber=...(tab)Currenttemp=...(tab)PowerOnHours=...(newline)
ReceiverID=...(tab)SerialNumber=...(tab)Currenttemp=...(tab)PowerOnHours=...(newline)...
1) first, I added a newline to mark each record sed -i 's/h/h\n/g' infile
,
2) then, I added the the tab delimiter sed -i '/.$/N; s/.\n/\t/' infile
It works but strangely, not everywhere. This is the output I get
ReceiverID=...(tab)SerialNumber=...(tab???)
Currenttemp=...(tab)PowerOnHours=...(newline)
ReceiverID=...(tab)SerialNumber=...(tab???)
Currenttemp=...(tab)PowerOnHours=...(newline)
What am I missing?? I welcome your input. Thanks.