User Profile

Collapse

Profile Sidebar

Collapse
DannyMc
DannyMc
Last Activity: Mar 4 '10, 09:18 AM
Joined: Aug 7 '07
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • DannyMc
    started a topic Shell script quoting and line read line

    Shell script quoting and line read line

    Hi all,

    I am in the progress of consolidating my 2 NIS databases into 1. My first step is to get the NIS record for particular department. I have software.csv which contain list of name in.

    software.csv:
    John Travolta
    Elthon John
    Sean King Ston
    Taylor Swif t
    Nicole cage
    .......

    I create a simple script to read from software.csv , called genlist.sh

    ...
    See more | Go to post

  • DannyMc
    started a topic sed to explode a full path

    sed to explode a full path

    Hi,

    i am quite new to sed and i wonder if there is anyway for me to explode the full path and take the last variable as the string ???

    /home/root/usr2/testdir1 --> so i can take testdir1
    /home/root/usr2/testdir3

    i need to write a script to tar and gzip a list of directory. please help, i am just lacking of sed part.

    thanks!
    See more | Go to post

  • Hi guys, i managed to solve my problem with the following scripts:

    Code:
    #!/usr/bin/python
    import re
    #fstab location, use w mode as need to overwrite whole file.
    s = open("/usr2/py/mount.txt","r")
    #temp txt file to store new mount.
    tmpfile = open("/usr2/py/tmp.txt","a")
    #new nas mount point
    newmount = open("/usr2/py/newmount.txt","r")
    ...
    See more | Go to post

    Leave a comment:


  • thanks for the solution bvdet!!
    See more | Go to post

    Leave a comment:


  • DannyMc
    started a topic Python to search text file string and replace it

    Python to search text file string and replace it

    Hi ,

    i am in the middle of creating the script to match the string and replace it

    in mount.txt
    mickey:/work1 /work1 bla bla bla
    mickey:/work2 /work2 bla bla bla
    micket:/job /job bla bla bla


    Code:
    #!/usr/bin/python
    import string
    s = open("/usr2/py/mount.txt","r+")
    for line in s.readlines():
       print line
       string.replace(line,
    ...
    See more | Go to post

  • DannyMc
    replied to Shell Script awk problem , please advice
    Again, Thank you. It works :)
    See more | Go to post

    Leave a comment:


  • DannyMc
    replied to Shell Script awk problem , please advice
    Hi again,

    i have tried to delete the file in awk using method found via google.

    Code:
    ls -l /usr1/ | grep ^d | grep -v current | awk -v p=103 '{ if ( $9 < p ) system("rm -rf " "\""$9"\"") }'
    This is working , however when i apply this to the script

    Code:
    echo " ls -l /usr1/ | grep ^d | grep -v current | awk -v p=103 '{ if ( $9 < p ) system("rm
    ...
    See more | Go to post

    Leave a comment:


  • DannyMc
    replied to Shell Script awk problem , please advice
    It works!!

    Thank you so much!
    See more | Go to post

    Leave a comment:


  • DannyMc
    started a topic Shell Script awk problem , please advice

    Shell Script awk problem , please advice

    Hi, i am currently writing a script to delete the directory named with number.

    Example:
    in /usr/
    i have
    /usr/101
    /usr/102 ...... /usr/200

    This is the command i type and it works, i got the directory listed where the number is <150

    Code:
    ls -l /usr/ | grep ^d | awk '{ if ( $9 < 150) print $9 }'
    So i applied it to the script, and it is not working especially...
    See more | Go to post

  • DannyMc
    started a topic RHEL 4 : how to remove /home automount ?

    RHEL 4 : how to remove /home automount ?

    Hi, I have installed RHEL4 in a box and right now i wanted to have symlink for /home.

    The /home by default is automounted(com e with installation). I wanted to remove the automount and create the symlink from /home -> /mydir .

    What i did was kill /home process, and rename it to home.old.

    Then i create a symlink

    ln -s /mydir /home

    it works until you reboot the server and...
    See more | Go to post

  • DannyMc
    replied to Javascript Split problem
    Thank you for the solution, it works!

    I thought myTemp1 supposed to be string, because i only assigned 1 variable to it. How come it is still array?
    See more | Go to post

    Leave a comment:


  • DannyMc
    started a topic Javascript Split problem

    Javascript Split problem

    Hi, I have written a code to split the string and here is the code.

    Code:
       var myString = (str);
    	   var myTemp1 = myString[11].split(",",1);
    	   var myTemp2 = new Array();
    	   myTemp2 = myTemp1.split("=",2);	
    		var myManager = myTemp2[1];
    I managed to get the value from myTemp1(tried it) but i have problem with
    Code:
    myTemp2 = myTemp1.split("=",2);
    ...
    See more | Go to post

  • Thank you Chaarmann, Your method seems to be more effective way to the javascript. However, i am still facing the same problem even using your suggested way.

    here is my function in php:
    Code:
    function open_me1(){
    window.open('http://www.google.com','height=300','width=250','location=no','menubar=no','resizable=no','scrollbars=yes','status=no','toolbar=no');
    Javascript:
    Code:
    <a href="javascript:open_me1();">Click
    ...
    See more | Go to post

    Leave a comment:


  • DannyMc
    started a topic window.open works in Firefox but not IE6/7

    window.open works in Firefox but not IE6/7

    Hi, i have tried this code in FireFox and it works great. However , it seems to fail in IE6/7. I have no idea and looking for help here. Please advice. Thank you.
    Code:
    <a
    ONCLICK="window.open('http://www.google.com,'height=180','width=250','location=no','menubar=no','resizable=no','scrollbars=yes','status=no','toolbar=no')" href="javascript:void(0)">
    Whois Agent local</a>
    ...
    See more | Go to post

  • DannyMc
    replied to Javascript split function
    Hi, I am using AjaxAgent from ajaxagent.org. I have modified the example code given in http://ajaxagent.org/doc.php . I will not attach agent.php in here(You will need it to run the code below).

    Code:
    <?php 
      // server side function
      function getdetail()
    {
    exec("ping www.google.com", $coutput);
    return $coutput;
    }
    ?>
    
    <?php 
      // STEP 1: INCLUDING
    ...
    See more | Go to post

    Leave a comment:


  • DannyMc
    started a topic Javascript split function

    Javascript split function

    Hi, i am currently having problem with the split function. Below are the code:

    Code:
    function callback_hello(str) {
           var str_b4_split = (str);
    	   var str_af_split = str_b4_split.split(" ");
    	  document.write(str_af_split);
    }
    callback_hello will receive a return string value and store in str_b4_split.

    I tried to display str_b4_split , and it is successful...
    See more | Go to post

  • DannyMc
    started a topic Get value from javascript to PHP
    in PHP

    Get value from javascript to PHP

    Hi,

    I am writing a PHP script to get a ping reply from my LAN PC. So, my idea is like this, when i mouseover/mouse click to the "hostname" display on the web. There will be a hint box appear and show me the ping result. Below is the php function to perform exec:

    [CODE=php]
    function getdetail($user 1)
    {
    $auser=$user1;
    exec("ping $auser", $coutput);
    foreach ($coutput...
    See more | Go to post
    Last edited by pbmods; Nov 26 '07, 03:55 PM. Reason: Fixed CODE tags.

  • DannyMc
    replied to Quoting a system call - double vs single
    in Perl
    Thanks Jeff, you reminded me to put the 'single quote' first before the "double" quote!! I have solved my minor problem now.

    Actually i have created a function to search for files for me inside a system. i will named it "getme" in this case.

    >getme name.cpp

    my function will print the result like this

    File(s) Found:

    ./abc
    ./123
    ./321...
    See more | Go to post

    Leave a comment:


  • DannyMc
    started a topic Quoting a system call - double vs single
    in Perl

    Quoting a system call - double vs single

    Hi, i faced a problem while executing code in double quote "" and single quote ''

    let say example, we type in manually:

    >ls abc | grep "\.\/"

    it works.

    and when i implement this into my script.

    $cmd1 = "ls abc | grep '\.\/'" #------> not working
    $cmd2 = "ls abc | grep \"\.\/\" # same like previous.

    ...
    See more | Go to post

  • DannyMc
    started a topic Execute download in Server side.
    in PHP

    Execute download in Server side.

    Hi , i came out with an idea like torrentflux , but this is a little bit different.

    I have a shared host, so i am planning to implement a script so that whenever i try to download a file, i will key in the address to the form, and once i submit the form, It will start downloading that particular file.

    Is this possible to do it with PHP and in server side as well? please advice.

    thank you
    See more | Go to post
No activity results to display
Show More
Working...