Results 1 to 3 of 3
Hi ALL
have a file (called it A) contains;
hostname 192.168.23.65
hostname 10.18.13.253
hostname 10.18.16.253
hostname 177.23.56.58
how can i write a script to get only ip addresses & send ...
- 05-07-2010 #1Just Joined!
- Join Date
- Mar 2010
- Posts
- 5
0utput IP to a file
Hi ALL
have a file (called it A) contains;
hostname 192.168.23.65
hostname 10.18.13.253
hostname 10.18.16.253
hostname 177.23.56.58
how can i write a script to get only ip addresses & send it to 3 files with the following info. only:
file1:
192.168.0.0
file2:
10.18.0.0
file3:
177.23.0.0
by creating the 3 files then i will be able to set up subnetmask, gw,....etc.
Thank you in advance.
- 05-07-2010 #2Linux User
- Join Date
- Nov 2009
- Location
- France
- Posts
- 292
This script doesn't produce your separate files. It constructs your unique netmasks, which you can redirect to a single file, then read each line and further redirect to separate files.Code:awk '{print $2}' /var/tmp/ip.txt | awk -F "." '{print $1"."$2"."0"."0}' | sort -u0 + 1 = 1 != 2 <> 3 != 4 ...
Until the camel can pass though the eye of the needle.
- 05-08-2010 #3Just Joined!
- Join Date
- Mar 2010
- Posts
- 5
Thanks NMSET. i will do that.


Reply With Quote