How to replace every 5th tab?

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

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

How to replace every 5th tab?

Postby ezinestein » 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

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

Re: How to replace every 5th tab?

Postby DataMystic Support » Thu May 12, 2011 11:03 am

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
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

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

Re: How to replace every 5th tab?

Postby ezinestein » Sun May 22, 2011 9:54 am

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: 2154
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: How to replace every 5th tab?

Postby DataMystic Support » Mon May 23, 2011 11:22 am

Hi Ed,

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

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: No registered users and 2 guests