Page 2 of 2 FirstFirst 12
Results 11 to 19 of 19

Thread: shell script to find the trafic of a website

  1. #11
    Join Date
    Nov 2007
    Beans
    59

    Re: shell script to find the trafic of a website

    thanx alot ghost dog..

    and if i want the script to search through all the files in the director that is in..what should i change??

  2. #12
    Join Date
    Sep 2006
    Beans
    2,914

    Re: shell script to find the trafic of a website

    Quote Originally Posted by psychobeauty View Post
    thanx alot ghost dog..

    and if i want the script to search through all the files in the director that is in..what should i change??
    i will leave it to you to try out. Its no fun if i do it for you. Here's a guide. Use a for loop to go through the files , read example 10-4 especially.

  3. #13
    Join Date
    Nov 2007
    Beans
    59

    Re: shell script to find the trafic of a website

    thanx a lot ghostdog
    Code:
    #!/bin/bash
    # list-glob.sh: Generating [list] in a for-loop, using "globbing"
    
    echo
    
    for file in *
    do
      .....
    can i use this!! for the script to work in the pwd..
    but then how can i make it to search the contents of all files..

    i know i cant do it with find...what command should i use//?
    sorry i am a ittle numb11

  4. #14
    Join Date
    Sep 2006
    Beans
    2,914

    Re: shell script to find the trafic of a website

    Code:
    read -p "what ?" vardate
    echo $vardate
    
    for files in *.ext
    do
      awk -v d="$vardate" '$0 ~ d{print}' $files
      read -p "Press enter to continue "
    done

  5. #15
    Join Date
    Nov 2007
    Beans
    59

    Re: shell script to find the trafic of a website

    Quote Originally Posted by ghostdog74 View Post
    Code:
    read -p "what ?" vardate
    echo $vardate
    
    for files in *.ext
    do
      awk -v d="$vardate" '$0 ~ d{print}' $files
      read -p "Press enter to continue "
    done

    its getting me an error..
    Code:
    what ?28
    28
    Press enter to continue read: 8: arg count
    Press enter to continue read: 8: arg count
    Press enter to continue read: 8: arg count
    Sun Apr 20 19:12:28 BST 2008
    Press enter to continue read: 8: arg count
    awk: read error (Is a directory)
    Press enter to continue read: 8: arg count
    Press enter to continue read: 8: arg count
    Press enter to continue read: 8: arg count

    and is only getting numbers input...
    Last edited by psychobeauty; April 24th, 2008 at 02:25 PM.

  6. #16
    Join Date
    Sep 2006
    Beans
    2,914

    Re: shell script to find the trafic of a website

    Quote Originally Posted by psychobeauty View Post
    its getting me an error..
    Code:
    what ?28
    28
    Press enter to continue read: 8: arg count
    Press enter to continue read: 8: arg count
    Press enter to continue read: 8: arg count
    Sun Apr 20 19:12:28 BST 2008
    Press enter to continue read: 8: arg count
    awk: read error (Is a directory)
    Press enter to continue read: 8: arg count
    Press enter to continue read: 8: arg count
    Press enter to continue read: 8: arg count

    and is only getting numbers input...
    what's the difference between the syntax in first read and the read in the loop?

  7. #17
    Join Date
    Apr 2006
    Location
    Phoenix, AZ
    Beans
    251
    Distro
    Ubuntu 8.04 Hardy Heron

    Re: shell script to find the trafic of a website

    Quote Originally Posted by ghostdog74 View Post
    so what is the "convenient shortcut" that you can use , for example, if you want to parse a log file of a certain format in Python or Ruby?
    Well if you were writing a log parser in Python or Ruby, you can store the parsed data in an object oriented way. A nice re-usable library in Python in Ruby could go a long way, depending on your needs. Maybe later on he would want that output to go somewhere else, etc. I have no bash experience, so I can't speak for that (I skimmed the overview, and saw no object oriented section).
    -Skeeterbug

  8. #18
    Join Date
    Nov 2007
    Beans
    59

    Re: shell script to find the trafic of a website

    Quote Originally Posted by ghostdog74 View Post
    what's the difference between the syntax in first read and the read in the loop?


    nothing!!!! i just type a number!!!

    the loop is has errors it doesnt let me to re-enter a number as it is suppose to!!

  9. #19
    Join Date
    Sep 2006
    Beans
    2,914

    Re: shell script to find the trafic of a website

    it works for me.

Page 2 of 2 FirstFirst 12

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •