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
Tag: regex
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
Select first match between two patterns.Restart search if a 3rd pattern is found using sed/awk/grep
I am struggling with the following task(I’ve been searching for answer for a while). The search is for text between START_PATTERN and END_PATTERN1 Having a file structured like this: The task would be to restart search if END_PATTERN2 is found. Thus the command output should be: Thank you for your time! Answer this line should work for your example: test:
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
How to delete prefix, suffix in a string matching a pattern and split on a character using sed?
I have the following string, which is the output of a cassandra query in bash I want to split this string so as to remove the string in the beginning till the last + symbol and then remove the tail end, which is (XYZ rows). So, the string becomes A|1|a B|2|b C|3|c D|4|d. Now, I want to split this string
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
How to GREP words, not lines, that contain specific characters, and print entire word
I have a file with tons of lines and words such as this example: What I want to do is list only the word (assuming each 4 character bundle is a word) that contains a specific number, such as 35. In this example, I would want the result printed to be: I have tried a few different ways such as
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