Programming :: Inverse Regexp Matching / Developing Of An Idea 'pattern Based Filtration'?

Sep 3, 2010

I am interested in the following problem: given a string (pattern) find a regexp which match this pattern.
I will need this for a developing of an idea 'pattern based filtration'.

View 3 Replies


ADVERTISEMENT

Programming :: Add Texts Using Sed In Matching Pattern?

Feb 3, 2011

I need to add some text using sed before and after the matching pattern. Does any one have any clue?e.g.cat /my/file | sed -e "s/first pattern/New Pattern/g" . /my/file.bakNow I need a result like New Pattern

View 7 Replies View Related

Programming :: Make X Number Of Changes Matching Pattern With Sed?

Aug 7, 2010

i tried searching on google but found it difficult to say exactly what I was looking for.Task - Capitalise x number of letters at the start of words.eg. Original line - one.two.three.fourRevised line - One.Two.three.four (here only requiring 2 changes)Test data:

Code:
wire.in.the.blood.s04e01.ws.pdtv.xvid-river.avi
wire.in.the.blood.s04e02.ws.pdtv.xvid-river.avi

[code]...

View 7 Replies View Related

Programming :: Sed: Delete Last Line Matching A Pattern?

Mar 27, 2011

I have a question about sed programming, actually a one-liner for which I cannot find a solution, right now. I need to delete a line matching a specific pattern only if it is the last line. In practice, I would put together the following:

Code:
#
# This deletes the last line of a file

[code]...

View 5 Replies View Related

Programming :: Multiple Line Pattern Matching And Variable Extraction?

Oct 19, 2010

I have this complex log file filled with entries like

test1-G1/0/0-100-QOS-7001923-ROUTING (ClassMap)
Action: Resolved New
sysName: test1.local

[code]...

View 1 Replies View Related

Programming :: File Renaming Based On A Pattern Match

Jan 8, 2011

What I am attempting to do is rename some television shows into the format that my PVR will understand for the naming convention. I have a script that cleans them up about 95%, now I just cant figure out the last little detail..

For example: NCIS_01.mkv
I think it can be done in sed, but I just figure out how. I need it to be renamed to: NCIS_s01e01.mkv

How can I make sed (or something else) match the last "_" and any numbers after it until the period and then insert text between them reliably?

Depending on the show, it can be something like: This_show_name_243.avi so I need it to be more flexible than I can figure out how to do..

View 6 Replies View Related

General :: Listing Files Using Pattern Matching

Mar 13, 2011

I have a requirement to list files using find command My folder contains below list of files with out extention.I have a requirement to exclude only ABC.123.* type files and list others. Even though files having MNO contains this pattern i should not exclude. Even if file ends with .txt or .doc it should not be excluded. That is ABC.123.1234.txt should not be excluded.But I am not getting what is required. Can any one please let me know if I am doing wrong any where. As per my requirement I cannot use grep, -regex, or -regex attributes to find command.

View 7 Replies View Related

General :: Copy All Files Matching Pattern From SRC To DST

Jul 19, 2011

If I wanted to copy all *.so files from src to dst I'd do:
cp src/*.so dst
However, I want to copy all *.so files from src and it's subdirs into dst.

View 2 Replies View Related

General :: Grep Or Sed To Delete Matching Pattern?

Jul 7, 2011

How can I use grep -Ev "pattern" not only to delete the matching "pattern" but to edit and save the file permanently as well

View 2 Replies View Related

General :: File Matching Pattern On Command Line?

Sep 9, 2011

I've got files in a directory as follows:

1.png
1_thumb.png
1-1.png
1-1_thumb.png

[code]....

I want to list all the files that don't have a copy with the same filename with -1 somewhere in it. So, in the example above, the results would be 3.png.

NB: the file and its copy with "-1" in it will be the same filesize, if that helps.

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

Programming :: Search A File For A Particular Pattern And If Pattern Found Replace The Line With New Text?

Feb 24, 2010

I want to search a file for a particular pattern and if pattern found replace the line with new text. i am using awk 'match($0,"pattern") != 0 {print $0} ' filename to check if the pattern exists.how do i get the line number of the pattern and delete that line and replace the line with my new text?

View 1 Replies View Related

Programming :: Matching Two Tables Of Non-matching Sizes?

Mar 2, 2011

I have two table files with x (1st column) ,y (2nd column) coordinates and intensity (3rd column). I need to match these two tables and divide the intensities at the consecutive coordinates on the 3rd column. The problem is the size of the tables are not same and I want to ignore the lines if they are not in one of the other file.

Here is Table 1:

Code:
-7.500-30.00013.006
-7.500-22.50037.952
-7.500-15.00060.962
-7.500-7.50040.922
-7.5000.00014.348
code....

View 3 Replies View Related

Programming :: If Statement Pattern Search / End Of Pattern Special Character?

Apr 29, 2010

I have to enhance the behaviour of a backup script written in perl. I don't need to change it, what I need to do is to create a bash script that does some checks like file name and file size, execute the backup script then check if the backup files match the original files.Here's how I try to do it:

- read the files from the original files folder
- store them in an array
- search in the array the files that have a specific file extension
- store the file names that match the search pattern (I know the backup script skips some files so I can hardcode the search pattern)
- run the backup script
- read the files from the backup folder
- store them in an array
- compare the original files name and size stored in an array with those from the backup folder
- send a report email

View 3 Replies View Related

General :: Parse A File And Print Each Line That Ends With Matching Pattern (if The Next Line Is Blank)

Aug 2, 2010

I've written a script to parse a file and print each line that ends with matching pattern, if the next line is blank. The pattern lines are the result of md5sum $i|sed 's/path///g' so that only md5 and filename appear. Here's what I'm using.

Quote:
for fline in `sed -n '/.*.ext$/p' file1`
do
if [ "`sed -n -e '/'"$fline"'/ {n; p;}' file1`" == "" ]
then
echo ""$fline" has no info" >>file2
fi
done
[Code]....

View 4 Replies View Related

Networking :: ISC DHCP - Class Matching Based On Mac Address

Aug 12, 2010

We have a large number of devices on our LAN with the mac prefix of 00:60:60. We want to assign these addresses from a separate address pool. I've created two classes, one to match 00:60:60 and another that I want to contain any other device. When i try to start the server I get:

/etc/dhcp3/dhcpd.conf line 33: boolean expression expected
match if not binary-to-ascii(16,8,":",substring(hardware, 1, 3))
^#this carrot should be under the last parenthesis#
Configuration file errors encountered -- exiting

Here is the relevant section of /etc/dhcp3/dhcpd.conf

class "006060" {
match if binary-to-ascii(16,8,":",substring(hardware, 1, 3)) = "00:60:60";
}

[Code].....

I've tried a few variations on that line. I've spent days trying to find any examples of "match if not" and haven't found anything. I assume it's going to be something to do with parenthesis/quote placement. Oh and this is ISC DHCP Server V3.0.4.

View 4 Replies View Related

General :: List Files Based On Matching Only Part Of Their Filename?

Sep 13, 2011

I have many files in a folder for example

Kiran.txt
Kiran1.txt
Kiran221.txt
Kiran144.txt
Time.csv

[Code]...

From this directory, I want to know how I could use grep to display files based on part of their filename - for example those starting with "Account" or those ending in ".sh".

View 4 Replies View Related

Software :: Pattern Macting Based On A Variable?

Jun 5, 2010

i have the follwing code

touch umer.txt
fdisk -l | grep 'Disk /' umer.txt
read file

[code]...

View 7 Replies View Related

Programming :: Migrate Regexp From SED To AWK?

Apr 22, 2010

I have a sed script to search and replace a pattern on the next kind of text:

Code:
C/username/Mydocuments/games & music
C/username/Mydocuments/New files 09-17-2007
C/username/settings
The script is:
code....

View 9 Replies View Related

Programming :: Developing Distro - Creating Own OS

May 1, 2009

I am very much interested in operating systems and I am a beginner. I just finished understanding OS concepts. I want to create my own OS. But I am thinking of creating a linux distro first and then going towards complicated things. How I need to equip myself for creating it. What should I know, learn and where to start.

View 6 Replies View Related

Programming :: Developing SW Library Of Routines?

Jun 9, 2010

I need to create a software library with two copy file routines in it. This library will be used in a TCL script. I know how to write the routines, but I have never created a library before. How do I do this?

View 6 Replies View Related

Programming :: Bash: Regexp In 'if' Doesn't Evaluate Correctly

Mar 1, 2011

I'm using an 'if' statement to check whether one of positional arguments is a word or a construction like "x-y", but something doesn't seem right.

Here is the relevant part of the code:

Code:
if [[ "$3" =~ [a-Z]-[a-Z] || "$3" =~ [a-Z] ]]; then
grepRange=$3; else grepRange=$4
fi
And for the input like this:

[Code]....

but shouldn't the $grepRange variable be blank in this case?

Bash version is 4.1.7(1)

View 6 Replies View Related

General :: Developing A Project In C Kernel Programming?

Mar 11, 2010

I am a Master's student.I am a newbie to Linux. I am interested in doing a term project in C kernel programming. I need help in developing a project in which I can use C kernel programming .

View 2 Replies View Related

Programming :: Developing HTML To PDF Converter Project?

Dec 31, 2010

I am new to linux. I am pursuing bachelors in computer science engineering. My final year project is to develop a "html to pdf converter using linux". I have some basic knowledge of commands used in unix

1) Where can I get the basic idea about the existing converters, their pros and cons.
2) Any kind of material or source where I can get basic idea.

View 14 Replies View Related

Programming :: Bash Regexp String Compare Stopped Working?

Oct 20, 2010

Have a bash script which contains a line like this:

if [[ ${array[${last}]} =~ "screenpc.PRODUCTION.*" ]]

which WORKED as expected in bash 4.0.33 and now fails in 4.1.2

Instrumented the script to print the value of the left-hand side and it is exactly what is expected.

As noted above, this has been working fine until we installed Fedora 13 (kernel 2.6.33), and now it fails.

Tried setting shell 'extglob' to On with same results.

Did something change? Are there other shell/bash options that need to be set?this has the whole installation stopped!

View 10 Replies View Related

Programming :: Get Perfect And Complete Way To Start Developing FW Application?

Jan 11, 2011

I would like to get help from experts who are experienced in the area of Linux network programming to help me to choose the proper way to create a special Firewall program.I do start reading WinSocket and tending to start BSD. I don't want to start with an API like winsock then stuck. So please, I do need a way to accomplish all features such as capturing, dropping or allowing all kinds of LAYERS as well as Intrusion detection.I am a good programmer in C++ but I am new for linux.So, what is the best Linux OS to install and start with and which is the best way to accomodate C++.

View 1 Replies View Related

Programming :: Developing Application Which Invokes Linux Exceutable

May 2, 2011

i am again stuck with the same problem. I need to run an executable which i got from University of Edinburgh.

View 14 Replies View Related

Programming :: Write Regexp That Matches String That Begins With Whitespace Or Contains Newline?

Dec 10, 2010

How do I write a regexp that matches a string that begins with whitespace or contains a newline, but not necessarily both?

View 2 Replies View Related

Programming :: Developing A Multi-language 'project' Using Subversion / Eclipse?

Jun 30, 2009

I'm starting work on a little project that uses alot of languages separately (i.e no interaction between languages. Does anyone have any experience like this and could pass on some recommendations as to best practises? I'm thinking either have a eclipse-project for each language stored under a single svn repo, or individual projects for each problem.

View 1 Replies View Related

Programming :: Sed Delete Lines From File One If Regexp Are Listed In File Two?

Sep 17, 2009

I am trying to delete lines of a file if they contain text that is present on another file. For example

> cat one.txt:

a
b
c
d

[code]....

I get the following output:

> ./test.sh one.txt two.txt
a
b
d
e

[code]....

View 6 Replies View Related







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