Ubuntu :: Grep - Regex And Searchstring With Singlequotes ?

Feb 4, 2011

At my work i have a legacy web system that tells the id of documents based on some given variables. this information can be used in another system to retrieve the needed file.

I am trying to automate this, and have managed to feed the variables and download the correct page using wget. The result is a result.php page with a lot of embedded info.

The information i am looking for is enclosed in single quotes on a line like this:

The information i want is the 1234 part.

I thought i could do like this from bash:

But I always get an empty string back... any idea what i am doing wrong?

View 1 Replies


ADVERTISEMENT

General :: Which Regex Standard Is Used In Grep?

Apr 12, 2011

I'm wondering if it's POSIX + ASCII or something else is mixed in?

View 1 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

Ubuntu :: Regex In Grep - Match With Any Character Combination

Dec 10, 2010

regex in grep? I need to match ANYTHING in the following with any character combination (something like * in findstr in C): grep "Delivery of nonspam" /var/log/mail.log | grep "to [URL]"

View 1 Replies View Related

Programming :: Input File - Grep Within Grep

Nov 22, 2010

I need to kind of grep within grep. My input file would be something like:

[Code]....

and I need to find the first occurrence of hello before MY PATTERN (hello 9008 in this case), so the output should be:

[Code]....

View 4 Replies View Related

Ubuntu :: Trying To Craft Tricky Sed Regex?

May 17, 2010

I'm trying to craft a tricky regex using Sed. I'm trying to clean up some code which has bazillions of lines over 80 characters in length, mainly because of these end-of-line comments. I want to change them to a nicer format. I've put the code on Pastebin because the formatting is better: [URL]. Bear in mind those are tabs, not spaces.

View 1 Replies View Related

Ubuntu :: XML Close Tag (RegEx) Substitution (Using Sed)?

Apr 22, 2011

This makes me feel like a total n00b but I'm trying to figure out how to replace an XML close tag (such as </pagenum> ) with the same XML close tag followed by yet another close tag. (I want every occurrence of '</pagenum>' to be replaced with '</pagenum></p>').

I've tried using something like this:
Code:
sed 's/</pagenum>/</pagenum></p>/' old.xml new.xml
What am I missing? Please forgive me. I'm diving head first into RegEx.

View 5 Replies View Related

Ubuntu :: Case Insensitive (Regex) CD For Script?

Oct 9, 2010

I know it's against the unix way and all that but I need a regex cd for a script to automatically move up an NTFS tree.

View 1 Replies View Related

Ubuntu :: LibreOffice Regex - Replace [:alpha:]$

Jun 20, 2011

My friend lost her dissertation and she had only a pdf copy of it. I am trying to convert the pdf into an odt format. After copy-pasting the content into an odt, i need to replace all paragraph breaks which are not following a dot with a space. For which i thought of using the regular expression feature of Libre Office. I've not succeeded so far.

I tried: to replace [:alpha:]$ or [a-z]$ or [a-z]>$ with space, but none of them worked. Finding [a-z] seems to work, finding [a-z]> too. So did finding $ (end of paragraph) but if i combine any regex with $ then it doesn't find anything.

View 7 Replies View Related

General :: Awk/regex With A Post?

Apr 2, 2010

I have a data file with the following format 0 i j # # # # with other random lines of text to be filtered out.The following script works when there aren't many #s, but it shuffles long lists of data.

/^0/ {
split($0,token)
printf("%s %s ", $2, $3)

[code]...

View 4 Replies View Related

Software :: How To Use Regex - PreSuf

Jul 18, 2011

So I just recently downloaded Regex-PreSuf. I believe it downloaded correctly, and also install correctly (did the following):

> downloaded it
> gzipped
> tar'ed
> perl Makefile.PL
> make
> make test
> make install

This is the file listing after the make install completed:

[Code]....

The output from the make, and make install gave the All OK, but there is no documentation with it that shows how to use it? Does anyone know what you have to do to use it? From what I read, it is used to enter a string and it gives you the regex that matches that string exactly? This is what I tried, from within the directory and its the output:

[Code]....

View 4 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

Ubuntu :: Text Manipulation - Regex - Pattern Matching?

Jul 12, 2010

Are there some good tutorials or reference materials on how do pattern matching and text manipulation in Linux?I have a few simple tasks I'd like taken care of...like formatting numbers in file names, stripping some text from directory names, etc

View 2 Replies View Related

Ubuntu :: Correct Syntax For Regex In Shell Script?

Nov 5, 2010

This command works to find files that have been updated in past 90 minutes:

Code:
find ( ! -regex '.*/..*' ) -type f -mmin -90
What changes need to be made to set this as an alias in, say, .cshrc file? I'm getting:

[code]....

View 5 Replies View Related

Ubuntu :: Bash - Delete First File Matching Regex?

Mar 27, 2011

In a bash shell script, I want to do something like this:

Code:
if [[ $(ls -ld /some/dir/foo_* | wc -l) -gt 4 ]]; then
rm -rf first_match_of /some/dir/foo_*

[code]....

View 6 Replies View Related

General :: Regex Edit In Skype?

Jan 13, 2010

I am not a big skype user, but I was chatting with my sister, made a typo and habitually typed

tpyo
s/tpyo/typo/

to my surprise it actually changed the history. I am using the linux skype client 2.1.0.47-r1 and my sister is using 4.something on windows.

When she tried to do the same thing, it didn't work. Does anyone know if this is specific to the linux version?

View 1 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

General :: Regex Escape The Comma?

Aug 12, 2010

sometimes there are one, sometime there are two exchanges in this log file. the 100= is the stock exchange- if there are two, they are seperated by a comma. i understand how to escape a comma in a regex, but I am having trouble with combining it.

35=8 39=1 38=1000 32=13 14=754 31=1.11 44=1.1 100=AMEX,ISE
35=8 39=1 38=1000 32=151 14=205 31=1.1 44=1.1 100=AMEX
35=U 39=2 38=1000 32=45 14=184 31=1.1 44=1.1 100=AMEX,ISE

[code]...

View 11 Replies View Related

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 View Related

Slackware :: Regex In Blacklist For Slackpkg - How To Use

Mar 30, 2011

Today I moved my Slackware64-current installations to multilib. I blacklisted the gcc and glib packages in the blacklist-file for slackpkg. In the blacklistfile they say:

Code:
# Now we can blacklist using regular expressions.
# This one will blacklist all SBo packages:
#[0-9]+_SBo
I have blacklisted

Code:
...
# The gcc compiler suite:
gcc
gcc-g++
gcc-gfortran
gcc-gnat
gcc-java
gcc-objc

# The GNU libc libraries:
glibc
glibc-i18n
glibc-profile
glibc-solibs
glibc-zoneinfo
glibc-debug
...

How I can use the mentioned regular expressions in order to make blacklisting more efficient?

View 2 Replies View Related

General :: Sed Regex To Match Words Via A Pattern

Oct 24, 2010

I have some lines of text and I want to detect words that meet some criteria with sed.

E.g. The line "tetris cat dog test cactus stereotype"

I want to detect the word that contains two (2) ore more t letters. That mean the words tetris, test and stereotype.

The following regex doesn't do the job because it can;t distinguish words very well.

I thinks I have ti incorporate something like [^ ] in the regex but I wasn't successful...

View 3 Replies View Related

Server :: REGEX From Array, Returns No Matches?

Jun 23, 2010

I'm attempting to use REGEX to isolate media (video and audio) essence that relate to alias/reference Quicktime movies. The Quicktime movie filename (excluding ".mov" can always be found in the media-essence filename.Stages of my process are:I cache the contents of a text file into an array ($file). This text file/array contains a list of Quicktime movies and media essence. Essence for each Quicktime movie is contained in this text file. An example text file is below:

Code:
MOVIE1.mov
media.dir/MOVIE1.m2v

[code]....

View 2 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







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