Programming :: Find With A Regex Path?

May 5, 2010

I'm using bash scripting to find any file that matches a path governed by the following regular expression:

"(monthly|nightly).[0-9]+/home/(user1|user2)/.mailbox/"
to match files like:
monthly.9/home/user1/.mailbox/l23131564
nightly.15/home/user2/.mailbox/cur/6546213

I've tried:

Code:
myRegex="(monthly|nightly).[0-9]+/home/(user1|user2)/.mailbox/"
find ./ -regextype posix-egrep -regex $myRegex

and it just spins and never gives me an answer, even though the file structure isn't that big.

View 8 Replies


ADVERTISEMENT

Programming :: Find A Proper Regex To Match The Two Numbers?

Nov 10, 2010

am trying to find a proper regex to match the two numbers in the following log entry.

Code:
15:08:16.142 INF Found 64468
15:08:16.142 ERR [Uniform test code=64469]

Basically the pattern I'm looking for will match the two different numbers spanned across two lines.Thought I need to use multi-line mode as follow but this doesn't match on [URL]...

Code:
/^($[0-9]{5}
[0-9]{5})$/m;

View 6 Replies View Related

Programming :: Java Regex - Use Regular Expressions Find Out What The First Two Characters Of The String Are

Feb 2, 2011

What I am doing is reading the text from a text document and storing all of the text inside of a ArrayList. I then set one of the values of the Arraylist as a string. I want to use regular expressions find out what the first two characters of the String are. if first two characters = "//" then function(); I only care about the first two characters though. If you need any more information, just ask.

View 4 Replies View Related

General :: Regex - Using Find To Locate Filenames Before A Certain Date?

Jul 11, 2011

I have a ton of files that are timestamped directories. These all look like2011-06-24_13.53.36 // a directory name for june 24th, 1:53:36 pmI have thousands of these directories. I want to do operations on some of the older ones. Let's say I give it a string for date time that matches that exact format, like i'll give it2011-06-25_00.00.00 // june 25th, 12amI want to find all the directories BEFORE my time. So if i give the string for 12am on june 25th, i want to find all the directories before then.If not i can find EVERY directory i have like this and then filter after wards. The created/modified dates are not tied to the actual timestamp im looking for (that would make this easier)

View 2 Replies View Related

General :: Regex To Find Min / Max Length Words In File?

Jan 29, 2011

i am trying to find all 3 and 4-character length words in my file (which is huge and has alot of entries in it, a big fat wordlist!).My attempt with this regular expression (which I thought should work, found something on length search here: [URL]

cat sorted_noapostrophe.txt| grep '.{3,4}'

but it returns no results? Also to find any words starting with 'f' which are between 3 and 5 characters (inclusive) long, how can this be done?

View 4 Replies View Related

Programming :: Java Applet Not Loading Image With Relative Path But With Absolute Path / Resolve It?

Jul 17, 2009

Java applet not loading image with relative path(e.g. images/1.jpg) but loads image with absolute path(i.e. from /root/user/images/1.jpg) . This is a problem when i want to host the applet on web server

View 2 Replies View Related

General :: 'find' Command Regex To Exclude Hidden Files?

Jun 28, 2010

I have the following command which finds all files that have changed in the last day and lists them. How can I exclude hidden files like .bash_history?

View 3 Replies View Related

Software :: Use Regex Or Pcre To Find Out The Matched From Multiple Textfiles?

Feb 7, 2010

I am trying to use regex or pcre to find out the matched from multiple textfiles. how to write a relative program on linux C?

View 3 Replies View Related

Programming :: Regex To Read An Ip?

May 14, 2011

I need a regex expression to read IP address from lines like these for my perl script:

Code:
2011.05.13-14:54:58, test@xyz.com, 180.211.51.11, pop3
2011.05.13-14:57:26, test@xyz.com, 160.234.47.12, pop3
2011.05.13-14:57:54, www@abcd.com, 166.22.22.224, imap
2011.05.13-14:57:55, www@somedomain.com, 172.58.22.154, imap
2011.05.13-15:03:08, www@example.com, 190.22.120.44, pop3

View 6 Replies View Related

Programming :: ! For Not Matching Bash Regex?

Jan 13, 2011

In a bash-script, only the case if a regular expression does not match is relevant.herefore I used the exclamation mark !. But where to place it?

These two work fine, but are they equivalent?
Code: if ! [[ $abc =~ $pattern ]]; then or
Code: if [[ ! $abc =~ $pattern ]]; then Where is the ! placed more correct?

View 2 Replies View Related

Programming :: Program To Use Grep W/regex?

Jun 1, 2011

I'm just starting out with bash scripting (yesterday, really). I want to add a file to each user's home directory, pretty simple really, and send it out via our Apple Remote Desktop system to our Macs. Here is my script: Code: #!/bin/bash

for i in $(ls -d /Users/*)
doif [ -e $i/.tcshrc ]
thenecho "$i/.tcshrc exists!"elseecho "$i/.tcshrc does not exist"

[code]....

View 6 Replies View Related

Programming :: Awk Computed Regex Not Working As Expected

May 31, 2011

So those of you that know me will agree that when it comes to awk I don't usually ask a lot of questions ... however this one has me stumped. I am guessing I have missed something obvious but for the life of me (and I have tested at great length) I cannot find it So the scenario is this: The following awk code should identify all versions of libgpg-error within the attached file (see below) and only show one for each version:

[Code]...

View 12 Replies View Related

Programming :: Bash-REGEX For Validating Computername?

Apr 3, 2011

I'm writing a script to read user input for a computername.I need a check that a given userinput is valid.Right now I use grep like this (for sure not optimal):Quote:

if echo "$name" | grep -q '[^a-z][^A-Z][^0-9]'; then
echo error
else

[code]....

View 12 Replies View Related

Programming :: BASH - Regex In A Case Statement?

Jun 9, 2010

the following works and BASH doesn't complain, but VIM highlights the closing square bracket is if it sees a syntax error. Is there a better way to express regex in a case statement or is this an issue with VIM?

Code:
#!/bin/bash
case $1 in

[code]...

View 3 Replies View Related

Programming :: Bash Regex String Extraction?

Jun 10, 2011

Code:
g echo ${mm[$j]}
4 BashNotes

[code]...

View 2 Replies View Related

Programming :: Specific Regex Pattern In Perl?

Feb 23, 2011

I'm fairly new to Perl and regular expressions. I have a large collection of files with their file names in the following general format: string - another string with spaces (2004) [year].ext I would like to know how I could create a regex to separate out:

the first string
another string with spaces
year
extension

If you know of a better way of doing it without regular expressions, I would be happy to hear that way too.

View 13 Replies View Related

Programming :: Perl Regex Matching HTML?

Mar 19, 2010

I'm trying to find out how to extract the string between the 2 <title> tags: <title>this is what i want</title>.I found lots of results but nothing I've tried works.. EG:$page =~ m/<title>($.)</title>/gism;

View 2 Replies View Related

Programming :: Insert A Variable Into A Regex In Perl?

Jan 17, 2010

I was wondering if you insert a variable into a regex in Perl, will the contents of the variable be expanded by the regex engine?

View 14 Replies View Related

Programming :: Perl - Regex With Array Elements?

Mar 13, 2011

I have .txt.gz files that store queries made on a browser, d my job is to analyze them.The information is stored in a xml-like style.Quote:

<browser>lwp-trivial/1.41</browser>
<http_code>200</http_code>
<keywords />

[code]...

View 6 Replies View Related

Programming :: Include A String Variable In A Regex (Perl)

Jan 9, 2010

how do you include a string variable as part of a regex in Perl?

View 5 Replies View Related

Programming :: If Statement Regex Match For White Spaces?

Apr 8, 2011

I want to match for this string:

Code:

Content-Transfer-Encoding:[:space:]base64
Content-Disposition:[:space:]attachment;[:space:]filename="%variable%"

Both lines are new lines, so they won't be inline. Other than that, they are all constants, I want this regex match to be an if statement rather than returning match string. so if the $content variable contains some string that matches:

Code:

if `sed "//p"` ;

View 4 Replies View Related

Programming :: Unable To Extract Java Regex For Links

Mar 22, 2011

Im trying to extract the href of a <link> tag from a html page however as some links contain further preferences I seem to be unable to extract them, do you have any idea how I can write this: Link:

[Code]...

View 9 Replies View Related

Programming :: Use Perl Regex To Extract The Hostname From A FQDN?

Nov 19, 2010

How do i use perl regex to extract the hostname from a FQDN?

I have

Quote:

$host=ganymede.a.linux.com
$host=io.a.linux.com
$host=europa.a.linux.com

i just want the characters which are to the left of the first .(dot) in FQDN name. I could get it using substr and split function,but how do i get it through regex.

View 13 Replies View Related

Programming :: Sed Regex Get Multiple String Match In Array?

Apr 8, 2011

I have a sed match that matches for certain string of a regex expression:

Code:
tname=$(echo "$contents" | sed -n 'some pattern')

How do I match for multiple strings in the $contents and return them as an array? for example

Code:
contents="this is a text, just to match patterns, here is another text to be matched"
the sed func would be able to recognize both "text"s, but only one is outputted?

Possible to put it in an array? so ${bar[0]} gives one and ${bar[1]} gives another

View 3 Replies View Related

Programming :: Perl Only Matching Single-character Regex Patterns?

Jan 20, 2009

I'm having a small issue with regex matching in Perl. I'm pretty certain it's a simple fix, but it all looks correct to me...

If I run the following:

Code:

It prints out all the lines containing a 'P', as one would expect. But when the regex is

Code:

I get zero lines printed. It seems to match only single-character patterns.

The file I'm reading is: (It has the same effect whether I leave it with Windows linebreaks or convert them to unix).

Code:

View 3 Replies View Related

Programming :: Perl Regex Not Matching Across Multiple Lines Despite Ms Flags / Fix It?

Aug 16, 2010

I have written a regular expression (tested in regexpal and regextester alpha something) with which I want to replace something like code...

but it only matches functions which occupy one line only, despite my tests showing multiple line matching in javascript testers online and using the m and s flags (which should make it multi line no?)

View 14 Replies View Related

Programming :: Construct A Quick Regex That Will Search For Six Lines Of Text

Apr 25, 2011

I am trying to construct a quick regex that will search for six lines of text without a clear line break between them. It only needs to search, not replace, as I will be using in gEdit (with regex plugin) anyway.

It's for editing subtitle files. The video player I will be using them on can only cope with 3-line subtitles, so I just need to edit any in the srt file that contain four or more. There won't be many so I can do it manually. For example:

26
00:01:47,357 --> 00:01:49,359
a motivated business
professional with
clearly defined goals.

[Code].....

but .* seems to mean "any character, or none", so that doesn't work. My experience of regular expressions is limited, but I do know they are very powerful when used correctly!

View 10 Replies View Related

General :: Command Path Is In PATH But Bash Does Not Find The Command

Jul 12, 2011

kernel 2.6.21.5, slackware 12.0
GNU bash 3.1.17

Code:

As you can see, /usr/local/bin is in the path. However, bash does not look for nasm in /usr/local/bin.

If I am root, things go well:

Code:

View 16 Replies View Related

Programming :: Can I Get Absolute Path Without Giving A "path" But Inode Number By C

Aug 13, 2010

Does anyone know how to get the path with a inode number by C programming?
Or can I get the absolute path without giving a "path" but a inode number by C?

like this: get_path(unsigned inode);
not such this function: getcwd(".", xxx);
taowuwen@gmail.com

View 7 Replies View Related

Programming :: Use Regex In Perl Script To Detect Allowed Words From The File And Then Print Output To The Screen?

Oct 4, 2010

Its my first post in here so please be patient I am trying to use regex in perl script to detect allowed words from the file and then print output to the screen.

As an example : I have text file with orders and returns :

Item2-SKU-2-11.08.2010-online
Item3-SKU-3-11.09.2010-return
Item4-SKU-4-11.09.2010-store

My question: is it possible to make sure that i am ony outputing to the screen orders based on few conditions like Item,order form e.g. online.And is it possible to have multiple matches (Item2 only diplay if ordered online etc)

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved