Ubuntu :: Mapping HAL's .fdi Expression To Xorg Expression?

Oct 6, 2010

I want to translate this .fdi clause

Quote:

<match key="info.product" string="PS/2 Generic Mouse">
<merge key="input.x11_options.EmulateWheel" type="string">true</merge>
<merge key="input.x11_options.EmulateWheelButton" type="string">2</merge>[code].....

into its Xorg equivalent. What does it look like?

View 1 Replies


ADVERTISEMENT

General :: SED Expression Does Not Work

Aug 25, 2011

I want to use sed to comment out a certain command in a js file. The command is called processLoad(..). I came up with expression below but it doesn't do what I expect it to do. The computer that I am on belongs to my provider, so I do not know the version of linux that is running on the machine.

[added:]
sed -r -i 's_^([ ]+processLoad.*)$_//1_' test.txt
I hope to replace a line:
processLoad('mystr');
into
// processLoad('mystr')

I figured out that '/' as substitute separation character would pose problems with the // as comments, so I choose _ as substitute separation character.

View 4 Replies View Related

General :: How To Use Regular Expression In Grep

Jan 21, 2010

On my server, logs are saved in log.gz format. I want to know what regular expression should i use to search both oracle and a particular IP, say 1.2.3.4 in a single log line ?

View 6 Replies View Related

Programming :: What Does The Following Shell Script Expression Mean

Nov 30, 2010

I've found the following script to copy files specified by a find output into a target directory.Code:find $SOURCE -name "*.avi" | xargs -i cp -v {} $TARGETWhat exactly does the colored expression mean? Does it refer to an array?

View 3 Replies View Related

Ubuntu Installation :: Console Command To Remove All <expression>

Feb 11, 2010

My console fu is a bit lacking, as it seems that I can't figure out how to uninstall all packages containing a certain expression.

I tried: apt-get remove *expression*

View 1 Replies View Related

General :: Embed Command Output In Sed Expression?

Feb 20, 2010

sed -i 's/EXTRAVERSION =/EXTRAVERSION = -$(date +%D)/g' file would search in the file, file for the string: 'EXTRAVERSION =', and change every instance it finds to 'EXTRAVERSION = -02/20/2010'. BUT IT DOESN'T.It changes it to 'EXTRAVERSION = $(date +%D)', literally. I've tried single and double quotes in almost every possible configuration. Is there any way to tell sed that one desires the command output, not the literal text?

View 7 Replies View Related

General :: Regular Expression In VIM Search And Replace?

Oct 22, 2009

I have two type of lines in a text file example

Code:

x.junk(a,b,YAHOO);
y.junk(c,d);

I want to search and replace the second type of line with the first type i.e. with YAHOO included, so that I have

Code:

x.junk(a,b,YAHOO);
y.junk(c,d,YAHOO);

I am trying to use

Code:

:%s/(.*).junk((.*),(.*)^<YAHOO>);/1.junk(2,3,YAHOO);/

In the above code ^<YAHOO> search is not working (I want lines "except YAHOO"). I know that [^ab] will work for "except a,b" characters. How can I say "except word" in regular expressions?

View 8 Replies View Related

General :: Sed: -e Expression #1, Char 27: Unterminated `s' Command

Feb 3, 2011

I am trying the execute the following

#!/usr/bin/python
import os
os.system("sed -e 's#^(.*) (.*)0http://12#' t2.txt > t3.txt")
os.system("cat t3.txt | sort | uniq -c | sort -rn | head > t4.txt")

But I receive the following error message.

sed: -e expression #1, char 27: unterminated `s' command

View 1 Replies View Related

Programming :: Bash - Expression Is Always Evaluating To True

Jun 7, 2011

This line if [[ $hamachi_reachable = true && $lan_reachable = true ]]; then is always evaluating to true. I gave two ips that are not valid, so that both variables would become false yet the whole expression is evaluating as true. With that set -x in there, I get this output.

Where am I going wrong?

Code:

View 11 Replies View Related

Programming :: Regular Expression {x} Doesn't Work?

Sep 2, 2010

I am trying myself on regular expressions. A read on [URL]/regex.htm) that {x} means search X times preceding character. So, why is this :

Code:
wstation~> echo '123456789' | grep [0-9][0-9][0-9]
123456789 # MATCH !! I have 3 numbers in a row.

[code]...

View 2 Replies View Related

Programming :: Extract A Substring Using Regular Expression With SED

May 7, 2011

I've spent most of the evening browsing the web, trying many things I've found on various forums, but nothing seems to work.

I have a test.txt file containing many lines like the following ones :

...
<insert_random_text>228.00 €<insert_more_random_text>
<insert_random_text>17.50 €<insert_more_random_text>
<insert_random_text>1238.13 €<insert_more_random_text>
...

And I want to extract :

...
228.00
17.50
1238.13
...

There is always one occurrence of € in each line. I want the numeric value that precedes this € occurrence. The random text (before and after) may contain numbers too, so the € may be important to parse, in order to correctly identify the number to return. The last character that precedes the number to extract is always a ">" (coming from an HTML tag).

View 9 Replies View Related

Programming :: Javascript Many Characters As Reg Expression Replace?

Jan 2, 2010

I'm working with javascript and trying to replace all instances of a Roman character in a string with nothing. How do I assign var reg to all Roman characters? In UTF8, capital letter A is U0041 and at the other end, small z is UFF5A.

So, I'd like to do something like:
var reg = u0041 - UFF5A;
str1 = str.replace(reg, '');

I think you get the idea. I have no idea if that can be done. The idea is to take this string (for example): str = make a door-to-door[house-to-house] visit / ring every doorbell." And take out all the Roman characters and define it as str1. And then take out all the Korean characters (u1100-uFFDC) and define it as str2. In fact, a WAY more useful thing to do would be to replace the instance of this: [u1100-uFFDC]+" "+[u0041-UFF5A] with [u1100-uFFDC]+","+[u0041-UFF5A] so that the output would be a .csv file.

View 5 Replies View Related

Programming :: Python Replace() With Regular Expression?

Mar 16, 2011

i cant use regular expression in replace function. I want to do this

a = ' Bad boy'
b = a.replace("b[aA]d", '')

Ofcourse this is a simple example for my query. Its not working so shall i assume regex dont work with replace function ?

View 1 Replies View Related

Programming :: Sed Regular Expression Match Everything Up To A Certain Character

May 27, 2009

I need to use sed to edit a file that contains just one line. This should be pretty simple, but I've googled and can't seem to figure it out. I need to match everything from a certain string up until the first comma in the line. There are multiple commas in the line and my matching pattern is matching up until the last comma, not the first.

Here is what I'm trying:

As you can see it is matching up until the last comma. Seems like the .* is matching any character including the other commas. The output from this that I am hoping to achieve:

How can I get the regular expression to match from asdf: up until the first comma?

View 3 Replies View Related

General :: Regular Expression To Grep For A N Digit Number?

Nov 23, 2010

I just want to grep for a n digit number followed by M alphabet. Generally for a three digit number i can give grep [0-9][0-9][0-9]M , but if the digits are increasing it is tough to represent them.

View 7 Replies View Related

General :: Bash Script Variable NULL Instead Of Value Of Expression?

Nov 17, 2010

Quote:

#!/bin/sh
for i in {1..10}
do
for j in {1..50}

[code]....

The first echo generates something like: abc.de.fgh The second echo generates:

View 3 Replies View Related

General :: Building A Regular Expression For Use In Split Function?

Apr 1, 2011

so I have a perl script that contains an array like this:@hostNames = (ABC123R:192.168.1.1, CBA321CBP:192.168.1.2, ZYX987R:192.168.1.3, etc firstelement"ABC123R:192.168.1.1":ABC123R is the hostname and 192.168.1.1 is it's IPaddress.I am trying to write a regular expression that will split the element with a '-' wherever there is a LETTER next to a NUMBER, like so:ABC-123-R:192.168.1.1I tried this expression below but am struggling with using regex for slightly complicated matching criteria:

for ($x = 0; $x < scalar(@hostNames); $x++)
{
$hostNames[$x] = split /([A-Z][0-9])/, "-"

[code]....

View 2 Replies View Related

General :: Ignore Case Only For Part Of Regular Expression

Feb 15, 2010

What I want to achieve is, if I have following in my file:
x y
X z
I should be able to find the pair, x Y and replace it with x a. So, basically I want to search for case sensitive 'x' but search and replace case insensitive 'y'. How should I do it? Can this be achieved with 'sed' command?

View 8 Replies View Related

Programming :: AWK: Compare Apache Dates Without Using Regular Expression

May 15, 2010

I'm writing a loganalysis application and wanted to grab apache log records between two certain dates. Assume that a date is formated as such: 22/Dec/2009:00:19 (day/month/year:hour:minute) Currently, I'm using a regular expression to replace the month name with its numeric value, remove the separators, so the above date is converted to: 221220090019 making a date comparison trivial.. but.. Running a regex on each record for large files, say, one containing a quarter million records, is extremely costly.. is there any other method not involving regex substitution? here's the function doing the convertion/comparison

[Code]...

View 13 Replies View Related

Programming :: Use A Regular Expression In Parantheses Like ([/+[]()]) To Get The Specific Letters?

May 3, 2010

I found such simple example of awk

Code:
awk '
BEGIN { a = "1abc 2def"
b = gensub(/(.+) (.+)/, "\2 \1", "g", a)
print b }'

However I don't understand why the regular expresion in parentheses doesn't work how I woud expect. If I delete the .+ so it does the same.

Code:
awk '
BEGIN { a = "1abc 2def"
b = gensub(/() ()/, "\2 \1", "g", a)
print b }'

I wanted to use a regular expression in parantheses like ([/+[]()]) to get the specific letters.

Code:
awk '
BEGIN { a = "1abc 2def"
b = gensub(/([/+[]()])/, "//\1", "g", a)
print b }'

But why the regexp in () isn't working

View 16 Replies View Related

Programming :: Awk - Substitution With Parts Of Matched Regular Expression Used?

Apr 30, 2011

I remember reading that using sed, you can do this with parentheses: s/abc(something)def/(something)else/g I can't find an explanation of how to do something like this with Awk. Say you have this in an HTML file, where (number) stands for a one or two-digit number:

<sup>(number)</sup>

And you want to change that to this:

<a name="(number)t" href="#(number)b"><sup>(number)</sup></a>

How would this be possible? Would you have to use sed?

View 4 Replies View Related

Programming :: Bash - Syntax For ((<arithmetic Expression>)) Usage ?

Mar 18, 2010

I do not understand bash' syntax regarding the use of ((<arithmetic expression>)). $((<arithmetic expression>)) is tokenised to a single word. OK.

Code:

In isolation

Code:

It may not be used where a word is expected. This generates a syntax error. Why?

Code:

View 6 Replies View Related

Programming :: Deleting Multiple Lines Above And Below Expression In File

May 19, 2010

I have a very, very large log file (360MB) that I'm trying to thin out. As it turns out the majority of this file has entries that aren't necessary so I'm attempting to build a command that will strip these out. The following command works to display only the data that I do not want:

Code:
cat xml_results.log | grep -B 6 -A 5 "YYY ZZZ"

This displays exactly the data I want to delete from the file by displaying the expression and six lines above it and five lines below it. However I'm at a loss as to how to remove this data from the output and display everything else. I looked into the -v option with grep redirecting the output to a new file:

Code:
cat xml_results.log | grep -B 6 -A 5 -v "YYY ZZZ" > xml_filtered_results.log

However it doesn't work, the new file is the same size as the old one. What am I doing wrong? Is there a better method of doing this? I'm a bit out of my element since the method I'd normally use can't handle files of this size.

View 7 Replies View Related

Programming :: Mount Expression Not Working In Nautilus Script?

May 20, 2011

Here is a segment from a script (the script is complicated so I'll just post the problem)

Code:
echo "sudo mount -o loop $eFile $eMount" > syntax.txt
sudo mount -o loop $eFile $eMount &> error.log

For debugging, I have the first line that echoes back the command being run (so I can find obvious syntax errors) and the second line runs the command.

The first line returns:

Code:
sudo mount -o loop /home/abigail.dunning/Training/1994-2010 Linux Journal Master Collection.iso /media/iso/1994-2010 Linux Journal Master Collection

If this line is cut and pasted into a bash shell it runs and the mount occurs fine.

However, this is being run in a nautilus script and the output of the same mount command is the syntax for mount?

Code:
# contents of error.log
Usage: mount -V : print version
mount -h : print this help
mount : list mounted filesystems

[Code].....

View 8 Replies View Related

Programming :: Perl Regular Expression To Change Character

May 26, 2009

Part of a perl script I am writing need to change the character at an index to upper case. Now i am new to perl and i am having some trouble getting it to do it. In c++ i would do something like

Code:

Now from what i understand the same thing is possible in perl using regular expressions. But i cant get it to work.

View 2 Replies View Related

Programming :: Regular Expression Double Escape For Files That End With .la ?

Mar 18, 2010

I have been battling with regular expressions and am a little lost. I want to find all my files that end with .la and have been trying this

Code:
slocate -r .la$

which finds them but also files like mozilla. The escaped full stop seems to be ignored however this works :

Code:
slocate -r \.la$

so why is the double escaping needed ?

View 3 Replies View Related

Ubuntu :: Correct Usage Of Perl Expression In 'rename'-shell Command

Jan 21, 2011

I want to rename some files in one directory and found the command 'rename' most appropriate.

Changing the file extension is easy since there are lot of examples for this.

But now I want to rename my files like this:

'somePrefix_blablabla.ext' --> '0_blablabla.ext'
'somePrefix_blablablablabla.ext' --> '0_blablablablabla.ext'

I DON'T want an incrementation, just the leading prefix '0_'

correct perl expression syntax for this?

View 2 Replies View Related

Programming :: String Comparison - Get Regular Expression To Work In If / Else Statement?

Jun 29, 2010

how do I get this regular expression to work in an if/else statement? This is just a little script for learning BASH. don't be too harsh.

This script will test if a certain number of files with 1-4 in their filename exist and print their filename. An error message will be printed if not.

#
for i in `ls file[1-9]`
do
if [[ "$i" == *1-4 ]] ; then
echo "This file, $i, ends in a number between 1-4"
else
echo "Error, this file, $i, does not end with a number between 1-4"
fi
done

I get this error. ./file_test.sh: 13: [[: not found

View 2 Replies View Related

General :: Regular Expression To Match Unspecified Number Of Characters Until A '>'?

Jul 7, 2010

I'm attempting to search through a rather large assortment of html files created in Word using 'save as html'. what I'm trying to do is find and delete these tags (they're causing browsers to display black diamonds with white question marks):

<span style='mso-spacerun:yes'> </span> Tags contain from 1 to 4 spaces between opening and closing. I get positive results from this:

grep <span style='mso-spacerun:yes'> filename.html but once I attempt to tell it to match any number of characters up until the next '>' symbol, it tells me I'm using an invalid regex: grep <span style='mso-spacerun:yes'>[^>]+> filename.html

I've been nose-deep in regex tutorials for the past day or so, and I'm still not understanding why this doesn't work. If I put the pattern (without backslashes) into a separate file and use `grep -f patternfile filename.html`, I get no error but no matches either. So far as I can figure, the above regex boils down to:
Match the string "<span style='mso-spacerun:yes'>", followed by any number of characters that are not a ">", followed by a ">". If someone could tell me where I'm going wrong with this,

View 7 Replies View Related

General :: Grep - Searching For Class References In C++ Using Regular Expression?

May 28, 2010

I'm trying to math all class references in a C++ file using grep with regular expression. I'm trying to know if a specific include is usuless or not, so I have to know if there is a refence in cpp. I wrote this RE that searches for a reference from class ABCZ, but unfortunately it isn't working as I espected:

grep -E '^[^(/*)(//)].*[^a-zA-Z]ABCZ[]*[*(<:;,{& ]'

^[^(/*)(//)] don't math comments in the begging of the line ( // or /* )
.* followed by any character
[^a-zA-Z] do not accept any caracter before the one I'm searching (like defABCZ)
[]* any white space (I can have something like ABCZ var; )
[*(<:;,{& ] followed by ( * < : ; , & { (I cant get #define "ABCZ.h" or ABCZdef for example)

Well, I can get patterns like this:

class Test: public ABCZ{
class Test: public ABCZ {
class Test : public ABCZ<T>

[code].....

View 2 Replies View Related







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