Is there any script or possibility to do this?
I mean, i have opened 30 files in notepad with numers in them. I need to find numbers bigger than 5000.
Is this possible? I tried using this, but notepad crashes. notepad++ find number greater than a specific number
You may try the following regular expression
[5-9]\d{3}|\d{4}\d+
Related
I have a folder with hundreds of text files in it. The file names have zero meaning. I am trying to extract a variable number that appears after a string in each file and and rename the files using it. I'm somewhat of a Powershell newbie (an old timer form the DOS world) but I have written many useful scripts with it. I've searched high an low, this one has me stumped.
Any and all suggestions are welcome, or I'd happily pay someone for the snippet of code. -Ed
looking for some pointers with using portqry and specifically, piping or modifying the output to a CSV.
I have around 20000 servers to check, all with a variance of 3-4 open ports to test and automating portqry seems the easiest way for me. Can't use 3rd party software as it's an Enterprise firewalled solution I'm testing.
So, I can easily use a FOR loop to make portqry run across a txt file line by line which outputs into another txt file.
This is fairly useless at the numbers I'm testing as I need to be able to filter and analyse the data easily.
I then moved onto using a couple of .bats to redirect my output based on the errorlevel of portqry, ie 0,1,2,3. Which kind of works but is still a pain as I have to hardcode the output for my CSV.
(Excuse the pseudo code)
:TOP
FOR %I in foo.txt, DO 'PORTQRY -n %I -e PORT#
#IF errorlevel =0 '%I,22,LISTENING' >> fooLISTENING.txt
goto END
ELSE
#IF errorlevel =1........
ETC ETC
This is still a bit of a pain as I'd rather see all targets in one place and then filter by listening, etc.
Another issue is that not being able to resolve the host doesn't seem to be an applicable errorlevel number.
At this point I'm starting to look at PowerShell to accomplish this, assign variables at each line then write them into a CSV, but it'd take a while to get that setup in my environment.
Any ideas while I have portqry though? Or indeed if you know of PS that would do the trick that'd be great too.
I have two binary files that I'm trying to compare using Matlab's built-in function visdiff, but it only displays the first 2000 bytes as a default. Is there any way to force the comparison tool to display the entire contents of both files side by side?
Edit the file matlabroot\toolbox\shared\comparisons\private\bindiff.m, where matlabroot is your MATLAB installation directory. On line 149, you'll see it sets the variable MAXLEN to 2000. Change this to something bigger (even Inf seems to work).
You may need to type rehash toolboxcache after making this change, in order to get MATLAB to notice.
Please note:
As you're making a change to the MATLAB source, this is at your own risk (it seems fine to me though). Keep a backup of the file you've edited.
That truncation at 2000 bytes is there for a reason - comparing the whole of larger binary files does seem to take quite a while, so be patient. Maybe try gradually increasing MAXLEN, rather than going straight to Inf.
I only have R2011b available to me right now, so if you're on a newer version the file path and line number I mentioned above may have changed. It was very easy to trace through the code from visdiff to comparisons_private to bindiff though, so unless they've changed the deeper structure of the Comparisons Tool between 11b and now, it will probably be very similar.
In view of my previous question Script for recursive add-to-source control: How to ignore specific files and folders, an issue that arose in regard to the command clearprompt (whereby to generate a list of elements for source control) is that it has restrictions on the number of elements it can process. So my question is: Is there a way to allow for a larger number of elements?
clearprompt has some limitation, in term of size, number of character per lines, and as you see, number of elements.
Those aren't fixed, on Windows or Unix, as far as I know.
So it is best to split your list, and to display several clearprompt dialogs, with a header specifying the number of said dialog over the total of number of windows expected (1/6, 2/6, 3/6, ...)
The only other solution would be to rely on another library to dispolay that dialog, but the advantage of using ccperl is that it is installed with the ClearCase client, which means it is available on all client workstation.
I believe I encounter a similar issue where because of this limit, the clearprompt dialog was empty. I debugged the script and the error seems to be because of the system limit of the max command line which was passed to echo in the following statement
`echo $listelement > $list_add`
I just changed this line to the following
open(LIST_ADD,">".$list_add);
print LIST_ADD $listelement;
close(LIST_ADD);
or basically, instead of relying on the shell to copy the content, I am doing the same through perl and that resolved the issue.
I am wondering if I have some code with line numbers embedded,
1 int a;
2 MyC b;
3 YourC c;
etc., and then I copy them and try to paste them in Eclipse, how to get rid of these line numbers to make the source code valid? Is there any convenient way, or a short-cut key?
Thank you.
Simply use the Alt+Shift+A (Eclipse 3.5 M5 and above) shortcut to toggle block selection mode. Then select the column with line numbers and delete it!
To make it easier you could setup a macro, but for that you need additional plug-in. I'm not aware of how to do it even easier.
Try this link. This is a dynamic online tool, where it is very easy to just copy paste code and get code without line numbers:
http://remove-line-numbers.ruurtjan.com/
You could use some script to do the work. For instance, using sed
I removed line numbers by find and replace with regular expression option.
Replacing regular expression \d+\s\s with empty string where \d+ means any combination of numbers and \s is actually a space (This is to avoid any numbers present in the code).
Best way is use SED command. Here you can specify as many as digit you want to replace.
in below example open copied code in VI editor and assuming its containing upto 1000 lines.
:%s/^[0-9][0-9|10-99|100-999]//g
if you want to use more lines then put one more or condition.