I hate to say it here, but EditPad Pro has this feature built-in. Enter your search string, click on "Fold lines", and all lines that don't contain the string will be collapsed.
- 3
I am new at Ultraedit, sorry just purchased the package. I have data that is to large for excel and was given instructions that I could use ^p 1050(end of line). My problem is I don't want to have the information after that line in the spreadsheet. How do I eliminate anything behind the 1050 or how so I remove those lines after the data is sorted? I can remove each line manually but that takes forever........Thanks for the help
I honestly don't understand your question. What is 1050? Could you describe in more detail what data you have and what data you'd rather have instead? Or did you mean that you want to delete everything after line number 1050? In that case, go to the beginning of line 1051, press Ctrl-Shift-End and press Del. But I suppose that's not what you really meant, is it?
- 3
Sorry for not being clear. I have 200 rows of data that is longer then 1051 but I only need 0-1051. when I use the ^p 1051 in special functions I get the first 1051 in the first row and what is left over in the second row and it repeats this way. Now I have the information in row 1,2,4,6 and so on. Going to each line and manually deleting takes to much time and sometimes there are two lines of extra data that I don't need. How can I eleminate the extra data or run a macro or something to deleate it.
Example:
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)
2326071059.1 IL0030803078 G W ENGLISH/III,MD (remove)
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)
2326071059.1 IL0030803078 G W ENGLISH/III,MD (remove)
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)
2326071059.1 IL0030803078 G W ENGLISH/III,MD (remove)
2326071059.1 IL0030803078 G W ENGLISH/III,MD (remove)
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)
Example:
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)
2326071059.1 IL0030803078 G W ENGLISH/III,MD (remove)
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)
2326071059.1 IL0030803078 G W ENGLISH/III,MD (remove)
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)
2326071059.1 IL0030803078 G W ENGLISH/III,MD (remove)
2326071059.1 IL0030803078 G W ENGLISH/III,MD (remove)
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)
For deleting everything in lines beyond a character position you can use the column mode activated via Column - Column Mode, make a rectangular selection starting at line 1, column 1051 to last line, longest line and delete the selected text. Same can be done with Edit - Select Range.
Possible would be also to use a Perl regular expression replace to keep the first 1051 characters of a line and delete the rest of the lines. Or with UE v14 and higher you can use the "Search in Column" feature, specify starting column 1051 and use as search string .+ (Unix/Perl) or ?+ (UltraEdit) as search string to find any character 1 or more times and use an empty replace string.
For your example the Unix/Perl regular expression replace search string is ^2326071059.*\r\n. The replace string is empty. This regex replace can be also done with the UltraEdit engine by searching for %2326071059*^p.
You must make sure that the last line of the file has a line termination or the regular expression replaces could fail on the last line.
Possible would be also to use a Perl regular expression replace to keep the first 1051 characters of a line and delete the rest of the lines. Or with UE v14 and higher you can use the "Search in Column" feature, specify starting column 1051 and use as search string .+ (Unix/Perl) or ?+ (UltraEdit) as search string to find any character 1 or more times and use an empty replace string.
For your example the Unix/Perl regular expression replace search string is ^2326071059.*\r\n. The replace string is empty. This regex replace can be also done with the UltraEdit engine by searching for %2326071059*^p.
You must make sure that the last line of the file has a line termination or the regular expression replaces could fail on the last line.
Best regards from an UC/UE/UES for Windows user from Austria
As Mofi has suggested above, you could use a Perl Regular expression to save only the first 1051 characters per line in a search and replace.
In the example you gave
if we do a Perl regex search for
^(.{1,57}).*$
and replace with
\1
we end up with
Just use
^(.{1,1051}).*$
instead.
Using {1,1051} will retain all lines shorter than 1051 as well.
If you wanted only the first 1051 of the lines that were at least 1051 long, use {1051}.
I'm using Ultraedit version 13.20
Cordially,
Jane
In the example you gave
Code: Select all
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)2326071059.1 IL0030803078 G W ENGLISH/III,MD (remove)
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)2326071059.1 IL0030803078 G W ENGLISH/III,MD (remove)
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)2326071059.1 IL0030803078 G W ENGLISH/III,MD (remove)2326071059.1 IL0030803078 G W ENGLISH/III,MD (remove)
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)
^(.{1,57}).*$
and replace with
\1
we end up with
Code: Select all
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)
1TX502 326071059.1 0000007911LACE BOBBY W 319 PINE (keep)
^(.{1,1051}).*$
instead.
Using {1,1051} will retain all lines shorter than 1051 as well.
If you wanted only the first 1051 of the lines that were at least 1051 long, use {1051}.
I'm using Ultraedit version 13.20
Cordially,
Jane
- 3
Thank you guys so much for your help, but if you could point me in the right direction to enter this string I would appreciate it very much.
Sorry, but we can't help you entering the regular expression search and replace strings. As a user of a computer you should be able to hit the keys by yourself. Open the Replace dialog for example with Ctrl+R and copy or enter the search and replace strings we have already posted. Check the regular expression option and run the replace. The regular expression engine can be selected directly in the Replace dialog since UE v14. Follow the instructions in the readme topic of the Find/Replace/Regular Expressions forum for selecting the regular expression engine.
Best regards from an UC/UE/UES for Windows user from Austria
My suggestion is to use TextHarvest from Parse-O-Matic.
Define a tool with something like this command line:
"C:\Program Files\PinnSoft\TextHarvest\TextHarvest.exe" /i"%F" /o"d:\tmp\output.txt"
And then open the output file and make sure you set UE to automatically update changes.
TextHarvest is a very good replacement for grep. It is a windows application and very easy to use by setting the Keep List and Delete List (Note that you have to separate items in the list using the '/' character).
A note for UE R&D:
It's too bad that UE does not have this feature integrated with it, forcing users to use such "tricks" to Hide lines NOT matching search string. I relay hope this feature will be available in future releases of UE (preferable the filter method - no need to open 2nd outoput file).
UE is the best text editor I know and I really think it should provide this so-commonly-used feature.
Thanks
Define a tool with something like this command line:
"C:\Program Files\PinnSoft\TextHarvest\TextHarvest.exe" /i"%F" /o"d:\tmp\output.txt"
And then open the output file and make sure you set UE to automatically update changes.
TextHarvest is a very good replacement for grep. It is a windows application and very easy to use by setting the Keep List and Delete List (Note that you have to separate items in the list using the '/' character).
A note for UE R&D:
It's too bad that UE does not have this feature integrated with it, forcing users to use such "tricks" to Hide lines NOT matching search string. I relay hope this feature will be available in future releases of UE (preferable the filter method - no need to open 2nd outoput file).
UE is the best text editor I know and I really think it should provide this so-commonly-used feature.
Thanks
Filtering lines using the Find command with UE v16.00+
Starting with UE v16.00 there are the buttons Hide Lines to hide all lines matching the specified search string using code folding and Show Lines to display only the lines matching the specified search string and hide all other using code folding. So the code folding feature must be enabled by checking the configuration settings Enable show/hide lines and code folding and Enable show/hide lines in non syntax highlighted files at Advanced - Configuration - Editor Display - Code Folding.
With command Edit - Delete - Delete All Hidden Lines introduced also with UltraEdit v16.00 all hidden lines can be deleted from the file.
See also the power tip Hide, Show, and Delete Found Lines in UltraEdit/UEStudio.
With command Edit - Delete - Delete All Hidden Lines introduced also with UltraEdit v16.00 all hidden lines can be deleted from the file.
See also the power tip Hide, Show, and Delete Found Lines in UltraEdit/UEStudio.
Best regards from an UC/UE/UES for Windows user from Austria
Re: Filtering lines using the Find command with UE v16.00+
Hi,
Is there a way to delete lines that do not contain specified string using these new Hide lines/Show lines and Delete all Hidden Lines options?
I'm trying to remove lines that do not contain </Source> string from large txt file. "Show lines" option allows to show only lines that contain that string, but it does not allow to delete lines that are not displayed and do not contain that string using Delet all Hiden Lines option.
Example: need to remove lines that do not contain </Source> string from the following text:
<Source>Percent abc </Source><target>omn klp</Target>
<Source>Launch and select</Source><target>klm kom</Target>
<source>Linear</Source><target>line</Target>
<source>Linear<target>line
<source>gauge</Source><target>abc def</Target>
Regards,
Greg
Is there a way to delete lines that do not contain specified string using these new Hide lines/Show lines and Delete all Hidden Lines options?
I'm trying to remove lines that do not contain </Source> string from large txt file. "Show lines" option allows to show only lines that contain that string, but it does not allow to delete lines that are not displayed and do not contain that string using Delet all Hiden Lines option.
Example: need to remove lines that do not contain </Source> string from the following text:
<Source>Percent abc </Source><target>omn klp</Target>
<Source>Launch and select</Source><target>klm kom</Target>
<source>Linear</Source><target>line</Target>
<source>Linear<target>line
<source>gauge</Source><target>abc def</Target>
Regards,
Greg
You can use as search string </Source> and use button Show Lines and after the search use Edit - Delete - Delete All Hidden Lines.
Or you use the information pietzcker posted at topic How to delete all lines not containing specific word or string or expression? and run a Perl regular expression replace all searching for ^(?:(?!</Source>).)*$\r\n and an empty replace string to delete all lines without </Source> directly.
Or you use the information pietzcker posted at topic How to delete all lines not containing specific word or string or expression? and run a Perl regular expression replace all searching for ^(?:(?!</Source>).)*$\r\n and an empty replace string to delete all lines without </Source> directly.
Best regards from an UC/UE/UES for Windows user from Austria
Thank you for help.
1. I've already tried and retried the first solution and no lines are deleted.
Deleting lines works fine when I use option Hide Lines, and then Edit - Delete - Delete All Hidden Lines,
but it does nothing when I use option Show Lines, and then Edit - Delete - Delete All Hidden Lines.
Currently I'm using version 16.10.0.1021. I'm registered user of version 15 and not yet upgraded to version 16.
2. Pearl regular expression works great. Thank you.
Regards
1. I've already tried and retried the first solution and no lines are deleted.
Deleting lines works fine when I use option Hide Lines, and then Edit - Delete - Delete All Hidden Lines,
but it does nothing when I use option Show Lines, and then Edit - Delete - Delete All Hidden Lines.
Currently I'm using version 16.10.0.1021. I'm registered user of version 15 and not yet upgraded to version 16.
2. Pearl regular expression works great. Thank you.
Regards
Yes, I confirm that this is currently not working. I reported this issue by email to IDM support together with some other hidden lines issues I detected as I played with this feature and got a confirmation reply by IDM support. One of the problems I reported is already fixed in a user verification build I got for testing. The others are forwarded to the developers.greg123 wrote:1. I've already tried and retried the first solution and no lines are deleted.
Update on 2010-07-07: The Show/Hide Lines and Delete All Hidden Lines issues were fixed in UltraEdit v16.10.0.1036.
Best regards from an UC/UE/UES for Windows user from Austria