How to cut the boldened url


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to cut the boldened url
# 1  
Old 08-14-2008
Question How to cut the boldened url

Following is a Webserver log

138.132.31.125 - mas@zir.com [12/Aug/2008:13:58:30 -0400] "GET HTTPS://post.zir.com/wps/PA_1_0_J4/zrec_portal/static/images/hdr_makepayment_gry.gif HTTP/1.1" 200 2421
72.123.254.143 - Unauth [12/Aug/2008:13:58:30 -0400] "GET HTTPS://load.zir.com/servlet/LSCallUMA?servName=retLinkURL&ATTRIBUTECODE=AMSSHSIAQuestion1 HTTP/1.1" 200 233
24.133.144.170 - Unauth [12/Aug/2008:13:58:30 -0400] "GET HTTPS://load.zir.com/un/fw/global/jscript/utility.js HTTP/1.1" 200 4543
38.88.254.53 - nedra@zir.com [12/Aug/2008:13:58:30 -0400] "GET HTTPS://post.zir.com/wps/PA_1_0_J4/z...paynow_off.gif HTTP/1.1" 200 1343
138.230.131.50 - Unauth [12/Aug/2008:13:58:30 -0400] "GET HTTPS://load.zir.com/un/fw/def/style/controls.css HTTP/1.1" 200 13138
138.132.31.125 - mas@zir.com [12/Aug/2008:13:58:30 -0400] "GET HTTPS://post.zir.com/wps/PA_1_0_J4/zrec_portal/static/images/btn_paynow_off.gif HTTP/1.1" 200 1343
38.31.248.171 - Unauth [12/Aug/2008:13:58:30 -0400] "GET HTTPS://load.zir.com/ls_launch_error.jsp HTTP/1.1" 302 1343
24.133.144.170 - Unauth [12/Aug/2008:13:58:30 -0400] "GET HTTPS://load.zir.com/un/fw/def/style/default.css HTTP/1.1" 200 542
203.13.72.28 - 53Q532@zir.com [12/Aug/2008:13:58:30 -0400] "GET HTTPS://post.zir.com/mylzir/images/icn_manageautopay.gif HTTP/1.1" 200 378
33.32.242.100 - yicsakatie@zir.net [12/Aug/2008:13:58:30 -0400] "GET HTTPS://labor.zir.com/static/images/corner_bottom_right.gif HTTP/1.0" 304 0

I need to cut the url part only boldened in Red and sort them according to the number of times they have been requested/accessed.

Basically, trying to use the following command

cut -f7 -d" " request.log | sort | uniq -c | sort | uniq -c

But,
cut -f7 -d" " request.log gives me the following result

HTTPS://post.zir.com/wps/PA_1_0_J4/z...ayment_gry.gif HTTP/1.1" 200 2421
HTTPS://load.zir.com/servlet/LSCallU...SHSIAQuestion1 HTTP/1.1" 200 233
HTTPS://load.zir.com/un/fw/global/jscript/utility.js HTTP/1.1" 200 4543
HTTPS://post.zir.com/wps/PA_1_0_J4/z...paynow_off.gif HTTP/1.1" 200
HTTPS://post.zir.com/wps/PA_1_0_J4/z...paynow_off.gif HTTP/1.1" 200

And so on whereas I only want the URL to sort the list.

Please help,

Thanks in Advance
# 2  
Old 08-14-2008
try this

cut -d "/" -f 5 filename
# 3  
Old 08-14-2008
Quote:
Originally Posted by vidyadhar85
try this

cut -d "/" -f 5 filename

Thanks a lot, vidyadhar

cut -d "/" -f5 request.log | sort | uniq -c

The above command worked.



Thanks
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Using :<<cut / cut to comment out block of bash script

I am using : << cut / cut to comment out block of code. Works fine on few lines of script, then it gives me this cryptic error when I try to comment out about 80 lines. The "warning " is at last line of script. done < results 169 echo "END read all positioning parameters" 170... (8 Replies)
Discussion started by: annacreek
8 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. 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

4. Shell Programming and Scripting

Cut Command error cut: Bad range

Hi Can anyone what I am doing wrong while using cut command. for f in *.log do logfilename=$f Log "Log file Name: $logfilename" logfile1=`basename $logfilename .log` flength=${#logfile1} Log "file length $flength" from_length=$(($flength - 15)) Log "from... (2 Replies)
Discussion started by: dgmm
2 Replies

5. Web Development

Regex to rewrite URL to another URL based on HTTP_HOST?

I am trying to find a way to test some code, but I need to rewrite a specific URL only from a specific HTTP_HOST The call goes out to http://SUB.DOMAIN.COM/showAssignment/7bde10b45efdd7a97629ef2fe01f7303/jsmodule/Nevow.Athena The ID in the middle is always random due to the cookie. I... (5 Replies)
Discussion started by: EXT3FSCK
5 Replies

6. UNIX for Dummies Questions & Answers

ReDirecting a URL to another URL - Linux

Hello, I need to redirect an existing URL, how can i do that? There's a current web address to a GUI that I have to redirect to another webaddress. Does anyone know how to do this? This is on Unix boxes Linux. example: https://m45.testing.address.net/host.php make it so the... (3 Replies)
Discussion started by: SkySmart
3 Replies

7. Shell Programming and Scripting

url calling and parameter passing to url in script

Hi all, I need to write a unix script in which need to call a url. Then need to pass parameters to that url. please help. Regards, gander_ss (1 Reply)
Discussion started by: gander_ss
1 Replies

8. UNIX for Advanced & Expert Users

url calling and parameter passing to url in script

Hi all, I need to write a unix script in which need to call a url. Then need to pass parameters to that url. please help. Regards, gander_ss (1 Reply)
Discussion started by: gander_ss
1 Replies
Login or Register to Ask a Question