Sponsored Content
Top Forums Shell Programming and Scripting how to filter files with given format Post 302689465 by esolvepolito on Tuesday 21st of August 2012 11:53:39 AM
Old 08-21-2012
how to filter files with given format

Hi, all, I have files like:
Code:
nameserver 216.66.22.2                           ; tserv1.ash1.ipv6.he.net. tserv13.ash1.ipv6.he.net.
nameserver 216.66.38.58                          ; tserv1.tor1.ipv6.he.net. tserv21.tor1.ipv6.he.net.
nameserver 216.218.221.6                         ; tserv1.hkg1.ipv6.he.net. tserv20.hkg1.ipv6.he.net.
nameserver 216.218.226.238                       ; tserv1.sea1.ipv6.he.net. tserv14.sea1.ipv6.he.net.
nameserver 2001:470:0:470::470                   ; ns1.fmt.he.net. - Filtered
nameserver 2001:470:0:471::471                   ; ns2.fmt.he.net. - Filtered
nameserver 2001:470:0:472::472                   ; ns1.sjc.he.net. - Filtered
nameserver 2001:470:0:473::473                   ; ns1.fmt2.he.net. - Filtered

;
; Cogent
; These servers may not be reachable as Cogent does not have peering with some ISPs and refuses to buy transit.
;
nameserver 2001:978:1:1::d                       ; eu-res1.dns.cogentco.com.
nameserver 2001:978:1:2::d                       ; eu-res2.dns.cogentco.com.
nameserver 2001:978:1:20::1a                     ; res1-fra03-v6.sys.cogentco.com.
nameserver 2001:978:1:22::1a                     ; res1-mad05-v6.sys.cogentco.com.
nameserver 2001:550:1:1::d                       ; na-res1.dns.cogentco.com.
nameserver 2001:550:1:2::d                       ; na-res2.dns.cogentco.com.
nameserver 2001:550:1:2:203:baff:fe2c:c022       ; <unknown>
nameserver 2001:550:1:20::1a                     ; res1-herndon-v6.sys.cogentco.com.
nameserver 2001:550:1:21::2a                     ; res2-herndon-v6.sys.cogentco.com.
nameserver 2001:550:1:22::1a                     ; res1-nyc-v6.sys.cogentco.com.
nameserver 2001:550:1:23::2a                     ; res2-nyc-v6.sys.cogentco.com.
nameserver 2001:550:1:24::1a                     ; res1-chi-v6.sys.cogentco.com.
nameserver 2001:550:1:25::2a                     ; res2-chi-v6.sys.cogentco.com.
nameserver 2001:550:1:26::1a                     ; res1-la-v6.sys.cogentco.com.
nameserver 2001:550:1:27::2a                     ; res2-la-v6.sys.cogentco.com.
nameserver 2001:550:1:27:203:baff:fe2c:c022      ; <unknown>

I want to extract the ipv4 addresses(the format is x.y.z.k) and put them into a new list

how to achieve this? thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Filter only gz files from list of subdirectories

Hi, I have a very big directory structure that consists of many sub-directories inside.There are around 50 ".gz" files under this dir structure. I want to copy all the gz files alone to a seperate location. Plz help me. (2 Replies)
Discussion started by: villain41
2 Replies

2. Shell Programming and Scripting

Filter files and print

Hi, I need to filter and store the files ends with log extension in the array and need to write the file names in the array to a file. I need to use array to derive this solution. Please help me out. Thanks (2 Replies)
Discussion started by: Sekar1
2 Replies

3. UNIX for Dummies Questions & Answers

Search and filter between two files

Hello, I have two files in this form that consist of three columns, a name (L*contig*), the length (length=**) and the sequence LT_file.txt LTcontig1 length=13 acccatgctttta LTcontig5 length=8 ggattacc LTcontig8 length=20 ccattgaccgtacctgatcg LTcontig23 length=5 accta and... (5 Replies)
Discussion started by: FelipeAd
5 Replies

4. Shell Programming and Scripting

Need script for transferring bulk files from one format to text format

"Help Me" Need script for transferring bulk files from one format to text format in a unix server. Please suggest (2 Replies)
Discussion started by: Kranthi Kumar
2 Replies

5. Shell Programming and Scripting

Copying the files after filter

Hi Guys, i want copy the all files another direcotry after filtering the command. and tried as like below...it's not working. ls -ltr|awk '{print $9}'|grep "images\|\.htm"|cp *.* /home/oracle Thanks (13 Replies)
Discussion started by: bmk
13 Replies

6. UNIX for Dummies Questions & Answers

Filter lines common in two files

Thanks everyone. I got that problem solved. I require one more help here. (Yes, UNIX definitely seems to be fun and useful, and I WILL eventually learn it for myself. But I am now on a different project and don't really have time to go through all the basics. So, I will really appreciate some... (6 Replies)
Discussion started by: latsyrc
6 Replies

7. Shell Programming and Scripting

<< Filter and Format the ouput >>

Hi All, I have a output like below $ cat aa.lst Value of output parameters --------------------------------------- Parameter Name : SNAPSHOTTIMESTAMP Parameter Value : 2014-01-07-15.21.50.022423 Parameter Name : DATABASESIZE Parameter Value : 96178176 ... (2 Replies)
Discussion started by: kamauv234
2 Replies

8. UNIX for Dummies Questions & Answers

Filter and merge 2 files problem

Hi, I'm trying to combine two files which have 1 column in common and filter out rows I don't need. File 1: ID Start End Matched Coverage 1 1 254 1515 5.96 2 1 135 402 2.98 File 2 (has 2 rows per entry): >1... (4 Replies)
Discussion started by: Yarinka
4 Replies

9. Shell Programming and Scripting

Filter using awk in CSV files

Hello Gentlemen, Finding difficulties to play with my Input files:confused: . Your guidance will certainly help as always. After converting to csv file from XLSM file, I am getting some extra ""(double quote) characters which I want to terminate inside shell script and process it further. ... (6 Replies)
Discussion started by: pradyumnajpn10
6 Replies

10. Shell Programming and Scripting

Can we filter the below log data into CSV format?

HI , I m looking for help here!!! Can we filter the below log data into CSV format ? timestamp INFO <text > - Some text Drive .. Need a format of separate field such as 1 2 3 4 ... (2 Replies)
Discussion started by: MohSalNiz
2 Replies
resolv.conf(5)							File Formats Manual						    resolv.conf(5)

Name
       resolv.conf - resolver configuration file

Description
       The  resolver  configuration  file, contains information that the resolver routines read the first time they are invoked by a process.  The
       resolver file contains ASCII text and lists the name-value pairs that provide various types of resolver information.

       The file is required if your system is running BIND.  This file must contain the BIND domain name for the local area network.  If your sys-
       tem is a BIND client, this file must also contain nameserver entries.

       There are two entry formats for the file:

       domain binddomain
	      This  line  specifies  the  default  domain to append to local host names.  If no domain entries are present, the domain returned by
	      after the first dot (.) is used.	If the host name does not contain a domain, the root domain is assumed.

       nameserver address
	      In this entry, the address is the IP address, in dot notation, of the BIND server that should be queried to resolve  host  name  and
	      address  information.   You should have at least one name server listed.	Two or more name servers reduces the possibility of inter-
	      rupted BIND service in the event that one of the servers is down.  You can list up to (10) name servers.	If more than one server is
	      listed,  the resolver library queries you to try them in the order listed.  If no name server entries are present, the default is to
	      use the name server on the local machine.

	      The algorithm used is to try a name server, and, if the query times out, to try the next, until out of name servers or the query	is
	      resolved.   The  last step is to repeat trying all the name servers until a maximum number of retries has been made or the query has
	      been resolved.

       The name value pair must appear on a single line, and the keyword or must start each line.

Examples
       The following is an example of a file:
       ;
       ; Data file for a client
       ;
       domain	      cities.us
       nameserver     128.11.22.33
       Lines beginning with a semicolon (;) are comment lines.

Files
See Also
       gethostname(2), resolver(3), named(8)
       Guide to the BIND Service

																    resolv.conf(5)
All times are GMT -4. The time now is 06:49 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy