How to replace every 5th tab?
Posted: Wed May 11, 2011 3:40 am
Hi,
I have a hundreds of files that contain only one long line with tab separators. I would like to put a line break or carriage return in place of every 5th tab but can't figure out how.
The files look like this... (it's all a single line)
word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab]word word [tab] word.
I would like to 'cut up' ... the one big line up into several lines. I want each resulting line to contain only 5 tabs. So I think I would need to replace every 5th tab with a line break... but like I said, I can't figure this one out.
Any help is much appreciated. Thank you.
Ed
I have a hundreds of files that contain only one long line with tab separators. I would like to put a line break or carriage return in place of every 5th tab but can't figure out how.
The files look like this... (it's all a single line)
word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab] word word [tab] word [tab] word word word [tab] word [tab]word word [tab] word.
I would like to 'cut up' ... the one big line up into several lines. I want each resulting line to contain only 5 tabs. So I think I would need to replace every 5th tab with a line break... but like I said, I can't figure this one out.
Any help is much appreciated. Thank you.
Ed