Sponsored Content
Full Discussion: bash scripting and awk help
Top Forums Shell Programming and Scripting bash scripting and awk help Post 302352457 by streetfighter2 on Friday 11th of September 2009 11:18:44 AM
Old 09-11-2009
Quote:
Originally Posted by vgersh99
Works fine with Solaris' "nawk"...
Could you elaborate on the 'not working correctly' part, pls?
I got it to work now. However, I am trying to figure out how to enclose this logic into an If statement in bash. Basically, my logic is if a valid hostname and ip appear on the same line then check to see if the hostname resolves to that ip that appears on that line.

I am thinking of passing the hostname ($1) to the host or nslookup command and check if $3 matches the ip address of the output of the host or nslookup command.

thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

bash/awk scripting help (creating OLD new users)

I need some help making this script... I guess I'm having trouble even interpretating what to even get started on... I need to create a script that will search a given directory (typically a user's home directory, but not necessarily) as provided on the command line and any sub-directors for... (2 Replies)
Discussion started by: Jukai
2 Replies

2. Shell Programming and Scripting

bash scripting help

hi all i'm trying to get a script working upon connection with pppd According to docu this happens ina clean environment with a couple of variables set, namely $1,$2,... To be able to execute the statements i included a path statement but i think i'm running into trouble with the variables -... (6 Replies)
Discussion started by: jimjones
6 Replies

3. Shell Programming and Scripting

bash scripting help!!

Hi, can anyone help me with my scrip please. I wanted do following tasks: 1. List all the directory 2. A STDIN to ask user to enter a directory name from listed directories 3. command to check if the directory exists( or a command to validate if the user entered a valid directory name)... (3 Replies)
Discussion started by: eminjan
3 Replies

4. Shell Programming and Scripting

please help with Bash Scripting????

Hi, can anyone help me with my scrip please. I wanted do following tasks: 1. List all the directory 2. A STDIN to ask user to enter a directory name from listed directories 3. command to check if the directory exists( or a command to validate if the user entered a valid directory name) ... (2 Replies)
Discussion started by: eminjan
2 Replies

5. Shell Programming and Scripting

scripting help with bash and awk

I'm trying to reformat some tide information into a useable format and failing. Input file is.... 4452 CHENNAI (MADRAS) 13°06'N, 80°18'E India East Coast 01 June 2009 UT(GMT) Data Area 3. Indian Ocean (northern part) and Red Sea to Singapore 01/06/2009 00:00 0.7 m 00:20 0.7 m 00:40... (3 Replies)
Discussion started by: garethsays
3 Replies

6. Homework & Coursework Questions

bash,scripting

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: i have to do this but i am confused, Create a file containing the bash functions which perform the... (1 Reply)
Discussion started by: CRAZYLITTLELOU
1 Replies

7. Shell Programming and Scripting

bash scripting help

have this code but when i run it i get this error ./pulse: line 2: and here is the code #!/bin/bash if ; then pulseaudio -k; fi what am i doing wrong thanks Adam (5 Replies)
Discussion started by: ab52
5 Replies

8. Shell Programming and Scripting

Bash scripting

Try to imagine a flag: nnnnx nnnxx nnxxx nxxxx now imagine how it will output: 4 times the "n"and 1 times "x" 3 times "n"and" 2 times" x " .. etc. .. rhombus is the same only instead of "n" is there gap "and " x "is a few times to form the correct shape Can you help... (3 Replies)
Discussion started by: krcek12
3 Replies

9. Shell Programming and Scripting

bash scripting help

Hi Guys i have a <script?> that spits out the location of each printer using snpget here is the code for i in `sed -n '/Start Printer/,/End Printer/p' /hosts/blah/etc/dhcp/hosts.conf | awk '!/^#/ {print $2}' | egrep -v \... (2 Replies)
Discussion started by: ab52
2 Replies

10. Shell Programming and Scripting

bash scripting

same script: 1- i am using grep to find a string called: tinker panic 0 in a file /etc/ntp.conf if the string is not there, i want to add the strings in /etc/ntp.conf file in the first line of the file. if not do nothing or exit. 2- also i want to add # in front of the following lines in... (0 Replies)
Discussion started by: lamoul
0 Replies
GEOIP_COUNTRY_CODE3_BY_NAME(3)						 1					    GEOIP_COUNTRY_CODE3_BY_NAME(3)

geoip_country_code3_by_name - Get the three letter country code

SYNOPSIS
string geoip_country_code3_by_name (string $hostname) DESCRIPTION
The geoip_country_code3_by_name(3) function will return the three letter country code corresponding to a hostname or an IP address. PARAMETERS
o $hostname - The hostname or IP address whose location is to be looked-up. RETURN VALUES
Returns the three letter country code on success, or FALSE if the address cannot be found in the database. EXAMPLES
Example #1 A geoip_country_code3_by_name(3) example This will print where the host example.com is located. <?php $country = geoip_country_code3_by_name('www.example.com'); if ($country) { echo 'This host is located in: ' . $country; } ?> The above example will output: This host is located in: USA SEE ALSO
geoip_country_code_by_name(3), geoip_country_name_by_name(3). PHP Documentation Group GEOIP_COUNTRY_CODE3_BY_NAME(3)
All times are GMT -4. The time now is 06:25 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy