How to replace every 5th tab?

Get help with installation and running here.

Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators

Post Reply
ezinestein
Posts: 13
Joined: Sat Nov 10, 2007 11:10 am

How to replace every 5th tab?

Post by ezinestein »

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
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: How to replace every 5th tab?

Post by DataMystic Support »

Lots of ways to do this Ed,

Easiest is an EasyPattern search/replace:

Code: Select all

[ 5 ( 1+ not tab, tab ) ]
replace with

Code: Select all

$0\r\n
ezinestein
Posts: 13
Joined: Sat Nov 10, 2007 11:10 am

Re: How to replace every 5th tab?

Post by ezinestein »

As always thanks for answering this! I've got another question but I'll post it in a new thread. It's probably easy too... but I just can't figure some of this out. The help files are good... but is there a more in depth manual somewhere that would teach me more of the stuff you know?

Thanks again.

ed
User avatar
DataMystic Support
Site Admin
Posts: 2227
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: How to replace every 5th tab?

Post by DataMystic Support »

Hi Ed,

There are lots of online reference for learning pattern matching - try this: http://www.datamystic.com/easypatterns_basics.html
Post Reply