Find the answer to your Linux question:
Results 1 to 4 of 4
Hi All, i need a quick help. i have two files file1 and file2. in one file file1 i have data like hostname1 hostname2 xxx.21.24.xxx hostname3 xxx.21.24.xxx in another files ...
  1. #1
    Just Joined!
    Join Date
    Sep 2007
    Posts
    5

    urgent help needed

    Hi All,

    i need a quick help. i have two files file1 and file2. in one file file1 i have data like


    hostname1


    hostname2
    xxx.21.24.xxx


    hostname3
    xxx.21.24.xxx

    in another files i have 7 to 8 field data , i want to insert the ip (from file1) with the corresponding hostname in a new field(in file2). it is very urgent . and the list is very big so If i do it manually , it will take hell lot of time

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Well, we obviously won't do the work for you, but if you write the script yourself and have a question about how a particular script line works, I'm sure someone here would be more than happy to help.

    You do the work. We answer questions. That's the best way to leverage our time. :)
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    Just Joined!
    Join Date
    Sep 2007
    Posts
    5
    hi
    i have written a script for this. but it does half of the work .


    #!/usr/bin/bash
    for host in `awk ' { print $2 }' /home/biswajit/hosts`;
    do
    inf=`awk '/'$host'/ {print $1}' /home/biswajit/hosts`
    echo -n $host; sudo ssh $host "ifconfig $inf | egrep \"broadcast|Bcast\" ; " >>
    ./broad_file
    echo -n $host; sudo ssh $host "netstat -rn | egrep \"\^default|\^0.0.0.0\" | aw
    k '{print $2}'" >> route_file
    done

    i want the out should be in two files broad_file and route_file . The data should collected like

    column1 column2
    hostame data




    please help me .

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Again, if you have questions about how a particular line should work, let us know.

    Maybe you can start by highlighting a particular line, showing us what the output is for that line, and how you would want it to change.

    I know this sounds impolite, but we need to spend our time focusing on particular questions of behavior of bash. (Maybe there is someone out there who is willing to actually do the programming, but he doesn't seem to have shown up.)

    If I had more time, I'd do the work. Let us know if you have specific questions.

    Sorry not to be more helpful than this.
    --
    Bill

    Old age and treachery will overcome youth and skill.

Posting Permissions

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