How to make 5 lines into one and re-sort sequence

General discussions about Advanced Find and Replace
Post Reply
Heike
Posts: 2
Joined: Tue Oct 31, 2006 6:56 pm
Location: Canada

How to make 5 lines into one and re-sort sequence

Post by Heike »

Hi there,

I was looking through previous posts but could not quite find a solution for my problem.

I would like to make the following change in my files:

original:

]
[
C3
0402
100n



]
[
C4
0805
100n



]
[
C5
0603
47u



]
[
C8
0402
100n


desired result:


'0402' ! '0402' ! '100n' ; C3
'0805' ! '0805' ! '100n' ; C4
'0603' ! '0603' ! '47u' ; C5
'0402' ! '0402' ! '100n' ; C8


Thank you very much for any help.

Heike

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Go to main menu - Action - Options - Batch Replace
check "Modifier S"

Go to Batch replace tab, check on "Use regular expressions".
Put into the grid, search for:
\]\s*\r\n\[\s*\r\n(.*)\s*\r\n(.*)\s*\r\n(.*)\s*$

Replace with:
'$2' ! '$2' ! '$3' ; $1

If you want to remove empty lines the second row in the batch grid
should be:
Search for:
\r\n\r\n

Replace with:
\r\n

That's all I verified it works perfectly.
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Heike
Posts: 2
Joined: Tue Oct 31, 2006 6:56 pm
Location: Canada

Post by Heike »

Thank you so much for your reply Roman but it did not work. There must be something wrong witht he "Search for" section because regardless of what I put in the "Replace with" section the original does not change much.

Any ideas?

Thanks,

Heike

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

Probably your text has some trailing spaces. Please send a sample
file to support@abacre.com
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Abacre
Site Admin
Posts: 1223
Joined: Mon Jan 31, 2005 5:32 pm

Post by Abacre »

After studying your sample files the correct sequence should be:

Search for:
\[\r\n(.*)\r\n(.*)\r\n(.*)\r\n.*\]

Replace with:
'$2' ! '$2' ! '$3' ; $1
Kind regards,
Abacre Limited
http://www.abacre.com
support@abacre.com

Post Reply