Page 1 of 1
How to Modify this?
Posted: Sun Feb 27, 2011 1:47 pm
by actroid
Hi All...
I'm really need advice how to edit large file txt format like this :
original file:
' abolish ' => ' annul ', ' abolition ' => ' extermination ', ' abominable ' => ' monstrous '
i need to replace like this :
' abolish ' => ' abolish ', ' abolition ' => ' abolition ', ' abominable ' => ' abominable '
And then how to make the exel file like this:
column1 column2 column3
' abolish ' = > ' abolish '
' abolition ' = > ' abolition '
Thanks a lof for all help,
Posted: Sun Feb 27, 2011 4:44 pm
by ben_josephs
Use "Posix" regular expression syntax:
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
Search | Replace... (
<F8>):
Find what: ^'([^']+)' => '[^']+', '([^']+)' => '[^']+', '([^']+)' => '[^']+'
Replace with: '\1' => '\1', '\2' => '\2', '\3' => '\3'
[X] Regular expression
Replace All
I don't understand your requirement concerning Excel files. TextPad is a text editor. Please restate what you need purely in terms of the text that you will pass to Excel.
Posted: Sun Feb 27, 2011 5:53 pm
by actroid
Thanks alot ben_josephs its work...but my file in one row
and the regex code only change 3 word and the other not....sorry bad in english hope you can undestand what i means...
Posted: Sun Feb 27, 2011 7:05 pm
by ben_josephs
Do you mean there may be many
'...' => '...' pairs on a line?
If so, try this:
Search | Replace... (
<F8>):
Find what: '([^']+)' => '[^']+'
Replace with: '\1' => '\1'
[Replace the underscore with a space]
[X] Regular expression
Replace All
Do you mean you want each adjusted pair to end up on a separate line?
If so, try this on the adjusted text:
Search | Replace... (
<F8>):
Find what: ,_ [Replace the underscore with a space]
Replace with: \n
[X] Regular expression
Replace All
These assume you are using Posix regular expression syntax:
Configure | Preferences | Editor
[X] Use POSIX regular expression syntax
Posted: Sun Feb 27, 2011 8:18 pm
by actroid
Find what: '([^']+)' => '[^']+'
Replace with: '\1' => '\1'
this work....i love this tool....
Now i have the data like this:
' disparity ' => ' disparity ', ' dispassionate ' => ' dispassionate ', ' dispatched ' => ' dispatched ', ' dispatcher ' => ' dispatcher '
its posible to change all in bold word ex: (p) with (q)
TQ TQ TQ
Posted: Sun Feb 27, 2011 8:36 pm
by ben_josephs
I have no idea what you mean. Please give an example of the text as it is and the text as you'd like it.
Posted: Sun Feb 27, 2011 8:42 pm
by actroid
' disparity ' => ' dTsparTty ', ' dispassionate ' => ' dTspassTonate ', ' dispatched ' => ' dTspatched ', ' dispatcher ' => ' dTspatcher '
Like that:
i need to change all i (column 3) with T
Posted: Sun Feb 27, 2011 9:17 pm
by ben_josephs
I don't understand the significance of "column 3". In what way does this not do what you want?
Find what: i
Replace with: T
Replace All
Posted: Sun Feb 27, 2011 9:31 pm
by actroid
' disparity ' => ' disparity '
' disparity ' === column 1
= > column 2
' disparity ' ===column 3
i only need replace i in column 3 with T (without replace i in column 1)
Posted: Sun Feb 27, 2011 10:45 pm
by ben_josephs
Is each pair is on a separate line?
If so, you can do this in steps:
1. Move all the text in each line starting at "
=>" to the right:
Find what: =>
Replace with: [Lots of spaces]=>
Replace All
2. Turn on block select mode (this requires you to be using a fixed-width font):
Configure | Block Select Mode
3. Select a block on the right that includes all of your last column but none of your first column.
4. Make the replacement within the selection:
Find what: i
Replace with: T
[X] Selected text
Replace All
5. Remove the spaces you put in earlier:
Find what: _+=> [Replace the underscore with a space]
Replace with: [Lots of spaces] _=> [Replace the underscore with a space]
[X] Regular expression
Replace All
(6. Turn off block select mode.)
Posted: Mon Feb 28, 2011 1:33 pm
by actroid
I read your instruction but i'm still cant change it ...when i try to change
ex: a .... all a change. All i need only ex: change a after => and before ',
the file in one row....
' abdomen ' => ' abdomen ', ' aberration ' => ' aberration '
Posted: Mon Feb 28, 2011 2:27 pm
by ben_josephs
I wrote:Is each pair is on a separate line?
If so...
It won't work if they're not.
Posted: Thu Mar 17, 2011 2:15 am
by jannypan
Do you mean you want each adjusted pair to end up on a separate line?