I'm having an issue about a code i should write...
I have a file... with the following numbers in regex format:
$ cat file_regex.txt
So this is a file cointaing some regex... so for each regex i need to create a number which is compatible to this regex... for example:
This:
Should transform into:
So what i need to do... is whenever is this file when there's some number into [], i need to remove this tags and get the first occurrence inside the brackets... so my outfile file will look like this:
$ cat output_file.txt
Any good ideas of how doing it?
I thought doing some thing with cut... but the way i thought... code will be very ugly, disgusting and not performative lol
Thanks
Last edited by Scrutinizer; 05-11-2012 at 01:14 PM..
Reason: code tags
In the perl below I am trying to extract and print specic values from patterns using multiple regex. One of the patterns AF= may be a whole number or a decimal but I can not seem
to capture both. I think it is the regex .*AF=(\d+\.\d+); as it is expecting a #.#### and it may only be a #. I tried... (2 Replies)
I have an interactive script which works terrific at processing a folder of unsorted files into new directories.
I am wondering how I could modify my script so that( upon execution) it provides an additional labelled summary file on my desktop that lists all of the files in each directory that... (4 Replies)
Help with creating regex in tripwire :
the rule is " The idea of it looks to ensure that just ‘share' isn't used in dfstab, must be /usr/sbin/share"
Perform the following to determine if the system is configured as recommended: # grep -v '^#' /etc/dfs/dfstab | grep 'share' | grep -v... (1 Reply)
How to reverse search for a matched string in a file. Get line# of the first matched line. I am getting '2' into 'lineNum' variable.
But it feels like I am using too many commands. Is there a better more efficiant way to do this on Unix?
abc.log
aaaaaaaaaaaaa
bbbbbbbbbbbbb... (11 Replies)
Hi,
I'm trying to reverse regex logic to use it in grep command. I would like to grep a string within a file that contains regex.
For example
file example.txt contains line:
match*
And I would like to find it using
grep match123 example.txt
Is it possible?
Thank you very much for all... (4 Replies)
Hello,
I am trying to find out the line numbers where regex match and put them into a file with below command:
awk '/'$pat'/ {print NR}' $fileName >> temp.txt
where $pat is the regex
but this command is taking a lot of time to execute with bigger files for size more than 5000000... (8 Replies)
Hi. Is there a way in awk to show all lines between a line number and the next line containing a particular regex? We can do these, of course:
awk '/regex1/,/regex2/' filename
awk 'FNR > X && FNR < Y' filename
But can they be combined? Thanks. (3 Replies)
so i have been trying to learn how to manipulate text on my own and have gotten stumped...
let's say i have a text file that says (highly simplified):
people ordinary
How would swap the order of the words..
I know i need to use sed and some kind of back reference but cannot make it... (2 Replies)