Programming :: Replacing Text With A Http Link With Sed?

Dec 10, 2010

Been at this all morning and fail on every attempt.

I have a file called sitemapindex.xml

Its contents just are names of the other sitemaps. Google gets pissy because it isn't in a http:// format.

So, I need "<loc>sitemap-c1mediawiki-............</loc>" to be replaced with "<loc>http://domain.tld/sitemap-c1mediawiki-............</loc>".

Here's the expression I've been trying:

find /path/to/site/sitemap-index-c1mediawiki* -type f | xargs sed -i 's/[<loc>sitemap]/[<loc>http://domain.tld/]/'

It fails.

I've tried with and without brackets.

View 4 Replies


ADVERTISEMENT

Programming :: Updating A Text File (replacing The Existing Parameters With The New Values)

Nov 9, 2010

I have a text file that needs to be updated to be used by some fortran code later. it looks like that:

1,1 !Ms for y-stations, Ns for x-stations
0,0,0, !xsta, ysta, zsta

I need to replace the "0,0,0" with new values for xsta,ysta and zsta;

View 4 Replies View Related

Programming :: Pull Http Links Out Of Text Files?

Aug 15, 2010

I am trying to figure out a way to pull http links out of text files and then output the results in a log. The text files are in folders like this inside a source directory.

/source
./folder1
...folder1.txt
./folder2
...folder1.txt

[Code]....

View 4 Replies View Related

Programming :: Change / LINK Text To Yellow , White , Red?

Apr 25, 2009

Can anyone tell me how to change the LINK text to yellow or white or red??
The page is ( http://www.multidistro.com ) code...

View 5 Replies View Related

Programming :: Replacing A String Of Text That Includes "/"

Sep 29, 2010

Suppose I have a file named temp.txt

cat temp.txt
word/one/two/three

If I would like to replace "one" with "six" I would do this:

cat temp.txt | sed 's/one/six/'
word/six/two/three

Now I want to replace "one/two" with "six/seven" and these options don't work:
cat temp.txt | sed 's/one/two/six/seven/' (OFCOURSE)
cat temp.txt | sed 's/"one/two"/"six/seven"/'

I even want to be able to replace "one/two" with "six/seven/eight"

View 6 Replies View Related

General :: Replacing Text In A File?

Jul 26, 2010

how to replace following text in the file name.cfg ?I need to replace

name:=inet.hr=>1|inet.hr=>1
with
name:=none
I am using
sed -i 's/name:=inet.hr=>1|inet.hr=>1/name:=none/g' name.cfg

View 4 Replies View Related

General :: Replacing The Text In Same File Using SED Command?

Oct 11, 2010

I have a String like "A.words=Ajay,Anil" in file A.And it contains a lot of other information also. I wanted to replace "Ajay,Anil" with "Vijay,Vinay" with sed command with using existing file only(not using another file)

View 9 Replies View Related

General :: Sed - Replacing Only Text With Several Specific Lines Excluded

Jun 17, 2010

As much as I didn't want to ask a sed question, especially considering there's already one on this page I've looked as best I could and cant find the solution. Id like to use sed to replace occurrences of a pattern but exclude two or 3 specific lines that are not consecutive. For example I know with 1,10 i could exclude the first 10 lines, what is the syntax if I just wanted to exclude line 3 and 7. The sed command I'm working with right now is for rearranging Ethernets.

cat /etc/udev/rules.d/70-persistent-net.rules | sed -e '/'"$found1fullmac"'/!s/eth1/'"found1eth"'/' > /etc/udev/rules.d/70-persistent-net.rules

I would like to replace $found1fullmac with two variables representing line numbers to exclude from the replacement.

View 6 Replies View Related

Programming :: Link Directories - Symlink Not Updated / Hard Link Not Supported?

Sep 6, 2010

In the ordering of files I keep I need links to directories. Sometimes I even need to move directories to new locations. I have tried using symlinks, but they become dead when I move the directory they point to. I have tried hard links, but I haven't found any Linux file system that would support hard linked directories. How can I achieve that a complex structure of directories (currently with symlinks for directories and hard links for files) keep symlinks live when directories are moved?

- is there any utility that updates symlinks when a directory is moved?

- is there any Linux filesystem that supports hard linked directories?

- is there any good Linux interface to the new NTFS (the only file system I know to support automatically updating directory links, called directory junctions)?

View 9 Replies View Related

Programming :: Replacing String Using Awk?

Jan 19, 2010

i have a string of information displayed in this way :

Code:
John:king:20:34:60
what i am tring to do is to read in input which is given by the user and change it to the

[code]....

View 3 Replies View Related

Programming :: Replacing The Last Digit?

Jun 23, 2010

i am trying to replace the last digit in the ip address(25) with 47 using following:Quote:echo 192.168.0.25|sed -r s/([0-9]*.[0-9]*.[0-9]*)/47/g'but not able so far, was wondering if you can help, so i can find my mistake.

View 6 Replies View Related

Programming :: Prevent Sed From Replacing With Newline

Nov 28, 2009

I'm writing a script to replace some text that exists in about 50 .lex, .y, and .cc source code files, sometimes more than once in a file. Sometimes the text is in a multiline C comment, and other times it's within a multiline C string.

I use sed to grab the start and end of each line and wrap the new text in the old whitespace and/or quotes and Problem is, sed is changing the characters into a newline.

Is there a way to tell sed to not process escape sequences? I tried using several variations of

Code:

To no avail. Or could it be bash?

I would give up on the script and do it by hand, but this is something that I must do from time to time.

Here's the function which replaces the first occurrence found:

Code:

When $post is printed by echo, it shows the - but by the time the file is on disk, it becomes a newline. What should I do to ensure that it stays as the characters ?

View 4 Replies View Related

Programming :: Replacing Space Characters W/ ' ' Using Tr?

Jun 16, 2010

Okay, so I have a .txt file, LL.txt; here is its contents:

Code:
/mnt/sda1/Music/Lydia Lunch/Honeymoon In Red
/mnt/sda1/Music/Lydia Lunch/Honeymoon In Red

[code]....

View 9 Replies View Related

Programming :: Replacing Set Of Characters In A Specific Line Using Sed Or Awk?

Dec 29, 2010

I would like to replace 'xxxx' with 'yyyy' which is in a file xyz.csproj not sure of what 'xxxx' is, it can be 3055, 4056, 7089 etc. I know it always appears at line # 5 and at character 50.

<Reference Include="System.Management" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Windows.Forms" />

[code]....

View 14 Replies View Related

Programming :: Replacing Numbers In Bash Scripts?

May 25, 2010

I have lines in some files that look exactly as below, and the line numbers they occur in are always the same. (Lines 136-139)

W 0.00000000 0.00000000 2.00000000
W 0.50000000 0.50000000 2.50000000
W 0.00000000 0.00000000 3.00000000

[code]...

View 1 Replies View Related

Programming :: Replacing Lines With Pattern Partialy By Different File?

Apr 12, 2010

I have two files, where the 1. file has special lines that need to be updated by lines from a 2. file:file1:

foo
foo
foo 0.00 0.00 0.00 pattern

[code]....

View 1 Replies View Related

Programming :: Bash Text To Variable Accessing Individual Text Lines?

May 2, 2010

i am on processing text tasks And i found that if you assign a text to a variable is chomp'ed automatically the newline

Code:

variable=$(cat file.txt)

The problem is i can only access the items/lines using:

Code:

for line in $variable
do
echo $line
# Other commands
done

how do i convert this to an indexed array. More importantly, how do i get access to individual $line[0], ..., $line[n] Another thing, if the file.txt, has lines with spaces it is a mess using the for...in..., but echoing prints line by line...o_0

View 11 Replies View Related

Programming :: Adding Lines Of Text To Beginning Of Text File

Jan 19, 2009

I need to insert 3-4 lines of text to the beginning of a text file. The file is a largish MYSQL dump, the result of a backup shell script. This shell script should insert the required text.I've wrestled with sed, but lost.

View 2 Replies View Related

Programming :: Delete Line Of Text From Text File Via Shell?

Jan 13, 2010

I have to delete a certain line of text from the a textfile via ubuntu's shell scripting.I have done research, and it seems that most people advocate the usage of sed /d option. sed makes does not edit the text file. Hence, most options I discovered involved the use of a temporary variable/textfile and then overwriting the old file with the temporary new file. Is there anyway whereby I can bypass the use of temporary storage containers? I hope there is any magical combination of commands to edit the file directly.

View 3 Replies View Related

Programming :: Exporting Glade Text View To Text File?

Jan 8, 2011

I want to display something in my text view widget in glade using c code. that's all right.
now I need to attach a save button beneath the text view.so that on click the text view content should save as a txt file..

View 8 Replies View Related

Programming :: Formatting Fields And Text Being Displayed From Text File?

Feb 9, 2011

I want to display the contents of a particular log file (simple text file, I mean in Linux). But there is a problem: The contents need to be organized in a fixed format. Have a look at this log file:

sampleLog.txt

Code:

User Name: XYZ
Reported Problems Description: Blah! Blah! Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah!

[code]....

So, while displaying the contents of above file on a web page, I want to format the field names found in the log file: User Name:, Reported Problems Description:, and Remarks:. These fields may contain a variable length of text and no specific line number is assumed for them to appear on.

The desired output should look like this:

User Name: XYZ
Reported Problems Description: Blah! Blah! Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah! Blah!Blah!

[code]....

Well, what I am trying to do may sound wierd to some of you. The filed "Reported Problems Description:" can possible contain text which embeds colon (.

View 15 Replies View Related

Programming :: Sed To Output Block Of Text If Specified Text Is Matched?

Feb 13, 2010

I am trying to find sed command combination to print out the "start command" line, the id line and all lines between "details" and "stop command" only if "error" exists. Here's the original output (test.txt):

start command
id 1
kajsdlfjsalj

[code]...

View 3 Replies View Related

Programming :: Add Text Before Line Number In Text File?

May 3, 2010

a sed command to add a text before line number in text file? I have text file with 500 lines, and i want to add 3 more lines with text after line 300, OR before line 302, isn't no problem.

View 16 Replies View Related

Programming :: Replacing The File In .Jar - Java.lang.NoClassDefFoundError Exception At Main Class

Jul 21, 2010

working on a script to update .Jar file, I have tried jar xf to unpack and jar cf to repack it is giving me java.lang.NoClassDefFoundError exception at main class. I also tried jar uf, which is also not working for me Basically my jar file requires to update date, which i do from "winrar" Manual it works fine, but now to remove "Donkey work", i want to make an script which does this all automatically, and the last stage is to update jar file which is not happening.

View 1 Replies View Related

Programming :: How To Listen To HTTP Request Using C++/C ?

Sep 14, 2009

Dear all,

My application has to listen to http request and it must be able to read the http header and then forward the request from proxy. All these things must be done on C/C++. please help me. Awaiting for your reply.

Thank in advance

View 4 Replies View Related

Programming :: Http Authentication With Libxml2

May 29, 2011

I'm trying to add HTTP authentication to my app (it's a rss reader). As the app is in written in C and uses Libxml2, I've been searching in Libxml2 doc, but it seems it's not possible. Maybe someone could point me to a link to relevant info about how I could achieve that?

View 6 Replies View Related

Programming :: Php And (pdf) File Sending By Http?

Dec 9, 2010

I have a web page that has links to a php script that sends pdf files to the browser when clicked.
The links are like this:

Code:
<a href="getfile.php?id=1201234">

The files sent are shown embedded in the browser, which is what I want.

The problem is: the title of the browser window or tab in which the pdf file is opened is "getfile.php?id=1201234"), and not the actual file name of the pdf file.

Is it possible to send the file by a php script in a way that the window/tab title becomes the filename and not the link by which it has been accessed?

View 5 Replies View Related

Programming :: Java - Many Redirects On HTTP Connection?

Feb 1, 2011

I'm trying to open a web page to automate some data checking, and I'm getting a "too many redirects" exception. I'm not experienced enough with Java to know what to try next, and would like some help.

I'll show the code for what I've tried, but first, details about the website:[URL].. The website is a series of aspx pages. Going to the above address in a browser gets you to "default.aspx"--a search page. You don't see the redirects (specifically to a Login.aspx page--which redirects back to default.aspx). I can get the search page with either Firefox or wget--and on the same computer that I'm writing the Java code on. So, Firefox and wget are doing something that my code isn't. Also, I'm not behind a proxy.

I've searched about the redirect exception, and one or two pages blame poor website development. That may be true, but I don't have any control over the website. So, fixing the website is not an option.

I did find this page where someone has the same issue. I used some code given in one of the responses to discover the default.aspx->Login.aspx->default.aspx redirection loop.

Much of my code was pulled from the Working with URLs and Working with Cookies tutorials from Oracle. I tried adding the cookie handler thinking that maybe Login.aspx was trying to create a session ID or some other connection-specific identifier. But either cookies are not the solution OR I just didn't code it the right way.

[Code]...

After more searching, I'm 99% certain it's a cookie-handling issue. I added some more code (not included in the above) that examines the full response from the redirect to the Login.aspx page. The response includes a Set-Cookie header for "ASP.NET_SessionId". Now to find some code that will store and send the session ID.

View 1 Replies View Related

Networking :: Craft A Valid Http/1.1 Request For Getting Http Headers (not The Html File Itself)

Sep 27, 2010

Using netcat, nc(1), craft a valid http/1.1 request for getting http headers (not the html file itself!) for the main index page of www dot aalto dot fi. What request method did you use? Which headers did you need to send to the server? What was the status code for the request? Which headers did the server return? Explain the purpose of each header.

nc -v www dot aalto dot fi 8080
HEAD / HTML/1.1
host: www dot aalto dot fi
And it returns:
200 OK
Content-Length: 858
Content-Type: text/html
Last-Modified: Thu, 02 Sep 2010 12:46:01 GMT
[Code]....

I really don't know what does it mean. Question 2: Using netcat, nc(1), start a bogus web server listening on the loopback interface port 8080. Verify with netstat(, that the server really is listening where it should be. Direct your browser to the bogus server and capture the User-Agent: header "Direct your browser to the bogus server and capture the User-Agent: header" I don't understand this question.

View 2 Replies View Related

Programming :: Execute C Program Through HTML On HTTP Web Server?

Oct 15, 2009

I would like to execute an already written C program that I am running on my embedded Linux, but from afar - through a HTML page. I am running an embedded Linux on my FPGA prototype board with a MicroBlaze soft processor. On this Linux i am running a httpd web server - I can serve html web pages to the outside through Ethernet connection. Now, I have a program written in C in this embedded Linux in /bin/gpio-test that does some stuff with my IO devices. Now I would like to control these IO devices through HTML web page - so I would like to be able to run this gpio-test program from a html web page and possibly send the program some parameters.

View 2 Replies View Related







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