Skip to content
Advertisement

Tag: regex

U-Boot version extraction for comparision

I am trying to extract U-Boot version from its binary for comparison, consider that exact string what I want to search is as follow, so I wrote command with regex as follows, However I don’t see any output for that above command, I could make below command work which extracts version only by comparing versions and not looking for date

How to replace special characters to underscore(_) perl

Using above code i am not able to handle this “Monday_øå_Tuesday_Wednesday” The output should be : Answer You can use W to negate the w character class, but the problem you’ve got is that w doesn’t match your non-ascii letters. So you need to do something like this instead: Outputs: This uses a unicode property – these are documented in

Grouping and deleting Files

I have to come up with a solution to delete all files but the newest 2 in a directory stucture of our owncloud. The be exact – its the file versioning folder. There are files in one folder with the following structure: Filename.Ext.v[random_Number] The hard part is that there are different files in one folder I need to keep. IE:

sed substitute with partial string

Is it possible to replace the last 5 characters of the line with the last 4 characters of the line in sed? My filenames can be any length but the end is always predictable i.e. the part I want to substitute is always 5 characters from the end Answer Just match them separately, and omit the undesired character: Another approach

grep mac address – 2 consecutive lines

My file consists of scan results. Each result can have 4-20 lines I want to filter only MAC addresses for Successful (Passed scans) My file: I would like to extract list of mac addressees that Passed scans. So in example if line contains “PASSED” and next line or 2 contain mac address … print mac addresses. I would be grateful

Complex regular subexpression recursion limit (32766) exceeded at

I have a perl script which performs a pgrep as follows: However when launch the script am having the following error/warning: Complex regular subexpression recursion limit (32766) exceeded at /home/k.sewnundun/test.pl line 16. Complex regular subexpression recursion limit (32766) exceeded at /home/k.sewnundun/test.pl line 16. Please find below the debug: What could be the issue? Thanks Answer This is a good sign

Dynamically-created ‘zip’ command not excluding directories properly

I’m the author of a utilty that makes compressing projects using zip a bit easier, especially when you have to compress regularly, such as for updating projects submitted to an application store (like Chrome’s Web Store). I’m attempting to make quite a few improvements, but have run into an issue, described below. A Quick Overview My utility’s command format is

Advertisement