Programming :: Perl Match Rss Tags ?

Apr 22, 2011

I am trying to match the rss files with regex:

If I have a file here:

Code:

I want to match watever that is within the <item></item> tags and save it in the $content variable. however, the <item> tags can spread over multiple lines:

Code:

View 1 Replies


ADVERTISEMENT

Programming :: Using Key To Match Against Source.txt File To Add Xml Tags To Names In Perl

Jun 21, 2010

Using a list of names (over 4000 of them) painstakingly gleaned from the source file years ago for a database file, I want to match the names against the source file so that they can be updated with the tags <forename></forename> in the original source file.

I placed the list of names in @forenames (only posted a few of them here).

Perl script is:

I am able to get the name bracketed by the tags to appear on the console screen but don't know how to apply the output to the source file. Perhaps I need to do a match on the words then some kind of edit to surround the matching words with the xml tags? I'm a rank novice doing this as a labour of love for a friend.

View 3 Replies View Related

Programming :: String Match In Perl ?

Sep 15, 2010

One of my application generates a text file with an XML output in it. I need to read that log files and if the output does not match to a string in couple of tags it should create a log file with the file name and the the tag name.

The two tags where the string should match is:

Identity format tag should always be JPEG , well- formed and valid status tags should be true.

sample output file:

View 7 Replies View Related

Programming :: Use Of Uninitialized Value In Pattern Match - Perl

Jun 26, 2011

I want to strip the process name from the hosts - i did it with the code below.

I have two questions - is there a more compact way to strip off the process names? usalso i want to get rid of the errors after extracting the hostname. It is complaing about $arry[1]. using my $arry[1] is not allowed. Assigning the slice to a value, as is 'my $sliced_arry = $arry[1]; print $sliced_arry , does not work either.

Code:

Use of uninitialized value in pattern match (m//) at newcomm_stats.pl3 line 7, <NEWCOMM> line 16 here i get what i want - just the host name, but still get those nasty errors. assigning a value to $1 does not work, and localizing $1 with 'my' is not allowed.

Code:

View 4 Replies View Related

Programming :: Sed - Awk - Perl - Merge Lines Unless They Match A Certain String

Apr 15, 2011

What is the best way to merge lines, in sed, awk or perl, that occur between certain strings? I'm new to sed scripting and I have been working on this for some time now. I have a large file (sample below) that I need to edit.

What I need looks something like this.

I'm working with a very large file so simply merging all the lines then adding a new line character before ">contig" and after "translated" won't work, at least not with sed.

View 5 Replies View Related

Programming :: Unable To Match Across Multiple Lines In Perl

May 11, 2011

I'm trying to split a text file into various parts. Everything in between "123" and "break" (including linebreaks) goes into the splitted file.

e.g. using this text file:

This should split into 4 files. However I'm only getting 2 files: one for the line "123break" and one for "123 blah break". The two occurrences that contain linebreaks are being ignored. The .* part of my match should capture linebreaks seeing that I'm using the /s modifier shouldn't it? Even when I use the match /(123 break)/gs it still doesn't capture the first occurrence. I'm using Perl v5.12.3 (from ActiveState) on Windows XP. The text file is also in Windows format.

Code listed below.

The above code generates two files Output_1.txt and Output_2.txt which contain "123break" and "123 blah break" respectively. I want it to generate four files.

View 4 Replies View Related

Programming :: Perl Match Character - Random Sentence Generator ?

Aug 11, 2010

I am trying to make a random sentence generator in perl. So far I can loop it x times to make a fixed quantity of words, but I don't want to do that. Or I can let it go on until I hit ctrl-C :/

I want to have it so that when it reaches a word with a sentence terminating punctuation mark it stops.

My attempt to do that was with:

This is doing the woooosh text until ctrl-C thing...

Now however I am not sure how I can cut off everything after the punctuation mark (when it exists).

View 1 Replies View Related

Programming :: Perl - Delete Line From Text File With Duplicate Match At Beginning Of Line

Apr 1, 2009

Was wondering if any perl guru's could help me with a quick log file adjustment. I have a text file that looks like so (tabs and newlines are revealed so you can see what separates the data):

There are maybe 100 lines of text in this file at any given time. I need to delete all duplicate lines only looking at the first bit of text prior to the first tab. It doesn't matter which one gets deleted as long as there are no two lines that begin with that same text at the beginning before the first tab. So in this example, either the fist line "1234" or the last line "1234" would need to be deleted. I already have code in my script that opens the files - I just need the code to read the text into an array and the part that would find matches based on the above criteria, and make the deletions.

If it would be easier, I can even do a system call and use SED (v4.1.5) and/or AWK (3.1.5) instead.

View 7 Replies View Related

Programming :: Match Datetime By The Minute (not An Exact Match By The Second)

Oct 21, 2010

I have the following query:

Code:
$sql="SELECT table1.datetime, table1.user_id, table2.ip, FROM table1,table2 WHERE id='$id' AND (table1.id = table2.id AND table1.datetime = table2.datetime)";

In table2 the datetime fields are about 1 to 2 seconds off due to the source of the data, which I cannot change.

Is it possible via a query match table1.datetime & table2.datetime by HH:MM (ie. to the minute instead of to the second)?

View 1 Replies View Related

Ubuntu Multimedia :: Configure Vlc That It Won't Show Tags - Ffmpeg Should Strip Tags

Dec 19, 2010

I have a lot of avis with annoying metadata that show in vlc. Since I cannot figure out how to configure vlc in a way that it won't show the tags, ffmpeg should strip the tags. This is supposed to do the trick:

[Code]...

View 7 Replies View Related

Programming :: Drm-intel Git Tags Too Old?

May 29, 2010

I want to git-bisect drm-intel between linux versions 2.6.32.3 and 2.6.33.1. I have git-cloned this:

Code:
git://git.kernel.org/pub/scm/linux/kernel/git/anholt/drm-intel
as given here and when i say

[code]....

View 1 Replies View Related

Programming :: Bash CGI Script HTML Tags ?

Jan 18, 2010

I have a fallowing simple CGI script:

Code:

Which after execution gives fallowing output:

Code:

The problem is that when I check [url] I get the fallowing error: malformed header from script. Bad header=<html><head><title>Test Page</: test2.sh.

However, the fallowing script works fine in browser:

Code:

The problem seems to be with HTML tags.

View 1 Replies View Related

Programming :: Link Titles - Get HTML Tags

Jul 8, 2010

I had a set of link titles and wanted to get HTML tags for them. Actually I wanted to get from

[code]...

It's PHP based (running on linux of course . I'm sure same thing is possible by some awk/sed magic, but i wanted somehting more visual.

View 1 Replies View Related

Programming :: [ Bash ] Count Nested HTML Tags?

Jan 7, 2011

I need to search through HTML files to count the number of <li> tags nested within the first <ul> tag:

Code:
<ul>
<li>text 1</li>
<li>text 2</li>
</ul>
...
<ul>

[Code]...

Unfortunately, the second grep is greedy swallowing everything up to the last </ul> close tag. (The desired result is 2.) Speed is an issue as I will be searching through 350,000 files.

View 14 Replies View Related

Programming :: Submitting Using Curl - Include Html Tags?

Jun 24, 2011

I am writing a script that is used to submit a package to testflight from my build system. In order to make the presentation as clear as possible I would like to include some basic HTML in the note section, however, using a < or > causes an error in curl. I have tried different variations of quoting and escaping but have not yet been able to find the solution.

Code:
VERSION_HEADER='<strong>Version: </strong>'
VERSION=`cat $VERSION_NUMBER_FILE`
NOTES+=( "$VERSION_HEADER$VERSION

[Code]...

If I use VERSION_HEADER="'<strong>Version: </strong>'" then the single quotes are submitted.

If I use < or > then those are submitted but the receiving api does not decode them correctly.

Can anyone suggest a way to submit exactly: <strong>Version: </strong>

View 3 Replies View Related

Programming :: Gedit - Plugin To Make HTML Tags From Words?

May 15, 2011

I need some plugin for Gedit (or maybe other HTML-editor) which will make tags of words, like: I type "div", hit some hotkeys or anything else with keyboard and get "<div></div>". The same with all the words I type in. Do you guys know which piece of software can do such things?

View 2 Replies View Related

Programming :: Html Tags Inside PHP Mail Body Message?

Mar 9, 2010

Trying to write a small php program to send emails using a form. I have collected all the information in php variables and I can send the mails just fine. But I need some neat and clean formatting for the mail that is received and hence thought html tables would be nice. But all the html tags are received as plain text and not html though I have mentioned in headers content-type to be html. Any links? If anyone can put some light on it? I thought that html tags would just work fine without much issue. I have tried same with asp and it worked.

PS: I am no programmer. Just trying my hands out on some php.

Edit: I am using a php mailer class from php classes to send mails. I need some way to use an external smtp server for sending mails. I have seen pear but I do not want to use pear. It is not available on the server I am testing and it is not possible for me to install it. I do not have access to install pear and can not ask to install it.

View 7 Replies View Related

Programming :: Python: Extract Names And Values From HTML Tags?

Feb 10, 2011

I'm working on a project at work to automate sending e-mails to customers.Everything is in place except my ability to extract the useful data from HTML tags to use in the formation of the POST.

Code:
<td width="25%" bgcolor="bisque"><b><font color="blue">From</font></b></td>
<td width="25%" bgcolor="bisque"><input type="text" name="TechName" value='MY NAME'></td>

[code]....

View 2 Replies View Related

Programming :: Use Awk Or Sed To Match ?

Apr 8, 2011

How awk and sed can be used to preg match strings? how would I go about matching a string like:

Code:

View 7 Replies View Related

Programming :: Make A Program That Maintains A List Of Tags That Can Be Attached To A Set Of Files?

Jul 28, 2010

I want to make a program that maintains a list of tags that can be attached to a set of files. Store the tags in the files. The main problem is that there is no way to get a list of all the tags without reading each and every file. And also what if you have an unused tag? Have a file that contains tag "keys" and file list "values". This seems like it would be fast and effective, but what if one of the files gets renamed?

View 12 Replies View Related

Programming :: Sed - Add A Line After A Match?

Sep 16, 2009

I need to edit the sudo file on lots of machines. I figure the easiest way is to run a for loop to ssh to each box, sed the sudoers file to a new file & copy/move back over the top of the original (and of course, change permissions accordingly)

The problem is, I'm not sure how to add a line after a match with sed.

So if my file looks like:

Code:

I'd like it to add the new sudoer after "other" so the file looks like:

Code:

View 2 Replies View Related

Programming :: Match A Literal String In Awk?

Jun 2, 2011

how I can match a literal string in awk i.e. making awk to *not* interpret the characters coressponding to its builtin operators in a given string. Take this code:

[Code]...

View 5 Replies View Related

Programming :: Cannot Match Strings That Appear To Be Identical

Feb 25, 2011

i have an sql table with 2 columns i run a script that randomly selects a word from the table in column 1.
the word is displayed on the screen and I guess what it means i concatenate the randomly selected word and the answer the script looks for a match in mysql if it finds a match it says "Good job!" if there is no match it will say "not correct". However when i get it right it says not correct even though when i echo the variables they look exactly the same. the script below:

#!/bin/bash
var=$(mysql translator -u root --password=*-N<<EOF
SELECT word FROM tagalog ORDER BY RAND() LIMIT 1
EOF
)

[Code]....

View 4 Replies View Related

Programming :: Delete Lines Between Match?

May 15, 2011

My problem is like this I have to delete all lines between two pattern match example- suppose below is the content of the file then i have to delete all lines between text1 and text2

...
text1
abc
def
ghi

[Code]....

View 14 Replies View Related

Programming :: No Match For 'operator<<' In '((HttpRequest*

Jul 13, 2011

I have a simple program from book C++ cookbook, page 291, 8.3, Using Constructors and Destructors to manage resources (or RAII), but it can not get compiled in my g++

------------------------------------------------------------------------------------------------
// Example 8-3. Using constructors and destructors
#include <iostream>
#include <string>
using namespace std;

[code]....

View 2 Replies View Related

Programming :: Sed Match Last X Lines Of A File

Mar 17, 2009

I'm trying to find the correct sed syntax to match from a given pattern to the end of the file and then append that pattern to the end of the file.

I was trying:

But that prints each line right after its original occurrence. I want to match the block and then append it to the end of the file.

View 12 Replies View Related

Programming :: Display All Lines Before A Match Is Found?

Sep 9, 2010

I have a file, and I have to display all the lines from the beginning of the file till a matching string is found.

I know grep with "-a", "-b" as option does exist, but it needs the number of lines to be printed in advance. eg grep -b 10 "search_string" file so it will print 10 lines before a match is found.

View 3 Replies View Related

Programming :: Match Strings Inside 2 Lists?

Jul 8, 2011

I have that script that checks the nfs mount points:

Code:
#!/bin/ksh
#set -xv
test="DO_NOT_DELETE"
rc=0

[Code]....

I am no expert in loops and it took me all day to write that. I couldn't really tell how to match the string in $df_file and $fs_share, so I did a little workaround with a count.

View 9 Replies View Related

Programming :: Sed Move To Prev Line If Match

Jan 31, 2010

sed move to prev line if match

file:

desired result:

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







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