parsing url string

Thread Tools Search this Thread
Top Forums Shell Programming and Scripting parsing url string
# 1  
Old 10-19-2007
parsing url string


I have a url like this:-

I want to parse the url string.I want to get the values

1.10529272 3.8379586

How do i do that?
# 2  
Old 10-19-2007
if you have GNU awk
awk 'BEGIN{}
 b = gensub(/.*pmid=(.+)..pmid=(.+)/, "\\1 \\2", "g", $0)
 print b

' "file"

# 3  
Old 10-19-2007
$ s=""
$ (IFS=+;set -- $(printf "%s" "$s"|cut -d+ -f2,4);printf "%s %s\n" "$1" "$2")
1.10529272 3.8379586

With GNU cut:
% s=""
% printf "%s" "$s"|cut -d+ -f2,4 --output-delimiter=" "
1.10529272 3.8379586

# 4  
Old 10-19-2007
awk -F"+" '{ print $2, $4 }' filename

# 5  
Old 10-22-2007
Originally Posted by matrixmadhan
awk -F"+" '{ print $2, $4 }' filename


Is there something in CGI which we can parse URL.

so that i can parse many values and get many pmid's!
# 6  
Old 10-22-2007
awk -v string="$s" 'BEGIN { 
startpmid = index(string,"pmid")
gsub(/[&=+]|pmid/," ",string)
print string 

# ./
   1.10529272     3.8379586    123456

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Url encoding a string using sed

Hi I was hoping some one would know if it is possible to url encode a string using sed? My problem is I have extracted some key value pairs from a text file with sed, and will be inserting these pairs as source variables into a curl script to automatically download some xml from our server. My... (5 Replies)
Discussion started by: Paul Walker
5 Replies

2. Shell Programming and Scripting

Reading URL using Mechanize and dump all the contents of the URL to a file

Hello, Am very new to perl , please help me here !! I need help in reading a URL from command line using PERL:: Mechanize and needs all the contents from the URL to get into a file. below is the script which i have written so far , #!/usr/bin/perl use LWP::UserAgent; use... (2 Replies)
Discussion started by: scott_cog
2 Replies

3. Post Here to Contact Site Administrators and Moderators

Page Not Found error while parsing url

Hi I just tried to post following link while answering, its not parsing properly, just try on your browser Tried to paste while answering : operator is not coming with HTML/PHP tags so attaching file (2 Replies)
Discussion started by: Akshay Hegde
2 Replies

4. Web Development

Append query string via URL rewrite in apache

Hi, Googled around but I couldn't find anything similar. I'm looking to do the following in apache.. if a user comes into the following URL. keep the URL exactly as is BUT add &something at the very end of it. thanks in... (1 Reply)
Discussion started by: kmaq7621
1 Replies

5. Shell Programming and Scripting

API Based URL Parsing

Hi Friends, We have a situation where we need to pass API based URL which will return XML response ,and I need to convert those XML response to a delimited flat file. url.txt -- will have (1 Reply)
Discussion started by: rakesh5300
1 Replies

6. UNIX for Dummies Questions & Answers

Awk: print all URL addresses between iframe tags without repeating an already printed URL

Here is what I have so far: find . -name "*php*" -or -name "*htm*" | xargs grep -i iframe | awk -F'"' '/<iframe*/{gsub(/.\*iframe>/,"\"");print $2}' Here is an example content of a PHP or HTM(HTML) file: <iframe src="http://ADDRESS_1/?click=5BBB08\" width=1 height=1... (18 Replies)
Discussion started by: striker4o
18 Replies

7. Shell Programming and Scripting

Parsing a long string string problem for procmail

Hi everyone, I am working on fetchmail + procmail to filter mails and I am having problem with parsing a long line in the body of the email. Could anyone help me construct a reg exp for this string below. It needs to match exactly as this string. GetRyt... (4 Replies)
Discussion started by: cwiggler
4 Replies

8. Shell Programming and Scripting

Splitting URL request string including escape characters

Hi All, I have a text file containing two fields, the first field holds the website name and the second one holds the rest of the URL (Request part). My requirement is to split the request part based on the characters "=" and "&". The process should also consider the URL escape characters, for... (4 Replies)
Discussion started by: john2022
4 Replies

9. Shell Programming and Scripting

pattern match url in string / PERL

Am trying to remove urls from text strings in PERL. I have the following but it does not seem to work: $remarks =~ s/www\.\s+\.com//gi; In English, I want to look for www. then I want to delete the www. and everything after it until I hit a space (but not including the space). It's not... (2 Replies)
Discussion started by: mrealty
2 Replies

10. Shell Programming and Scripting

Parsing of file for Report Generation (String parsing and splitting)

Hey guys, I have this file generated by me... i want to create some HTML output from it. The problem is that i am really confused about how do I go about reading the file. The file is in the following format: TID1 Name1 ATime=xx AResult=yyy AExpected=yyy BTime=xx BResult=yyy... (8 Replies)
Discussion started by: umar.shaikh
8 Replies
Login or Register to Ask a Question