Sponsored Content
Top Forums Shell Programming and Scripting Parsing out data with multiple field separators Post 303005382 by bakunin on Tuesday 17th of October 2017 01:39:23 PM
Old 10-17-2017
Quote:
Originally Posted by ncwxpanther
I have a large file that I need to print certain sections out of.
The basic problem is that you need to define what a "section" is: the line you presented uses different separators to delimit what i suppose is a "section" in your wording: spaces (or maybe tabs), dots, slashes and colons.

Will these four (five) characters always be delimiters?

Will the lines always have the same structure? (like "First 7 parts separated by "/", the seventh part consists of 6 parts separated by ".", then a colon, then ....")

If you could answer these questions we could perhaps provide better solutions which might work better. Without this information we will never be sure to have really solved the problem.

I hope this helps.

bakunin
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Awk Multiple Field Separators

Hi Guys, I'm tying to split a line similar to this:YO6-2000-30.htm: (3 properties found).......into separate columns, so effectively I need to check for a -, ., :, a tab and a space in the statement. Any help would be appreciated Thanks! (7 Replies)
Discussion started by: Tonka52
7 Replies

2. Shell Programming and Scripting

I need help counting the fields and field separators using Nawk

I need help counting the fields and field separators using Nawk. I have a file that has multiple lines on it and I need to read the file 1 at a time and then count the fields and field separators and then store those numbers in variables. I then need to delete the first 5 fields and the blank... (3 Replies)
Discussion started by: scrappycc
3 Replies

3. Shell Programming and Scripting

Multiple input field Separators in awk.

I saw a couple of posts here referencing how to handle more than one input field separator in awk. I figured I would share how I (just!) figured out how to turn this line in a logfile: 90000000000000000000010001 name... (4 Replies)
Discussion started by: kinksville
4 Replies

4. UNIX for Dummies Questions & Answers

Multiple field separators in awk? (First a space, then a colon)

How do I deal with extracting a portion of a record when multiple field separators are involved. Let's say I have: Mike Harrington;(555) 555-5555:250:100:175 Christian Dobbins;(555) 555-2358:155:90:201 Susan Dalsass;(555) 555-6279:250:60:50 Archie McNichol;(555) 555-1348:250:100:175 Jody... (3 Replies)
Discussion started by: doubleminus
3 Replies

5. Shell Programming and Scripting

Fixed width file with newline field separators

I have some huge files that are produced daily from a production system written in basic (really). The files are fixed width records, 512 bytes, with newline field separators, newlines if the field is null, and trailing newlines for null fields. The data in the fields can be any ascii... (0 Replies)
Discussion started by: vtischuk@yahoo.
0 Replies

6. Shell Programming and Scripting

Problem with changing field separators in a file

I have a file with content as shown below. cat t2 : 100,100,"X",1234,"12A",,,"ab,c" Comma is the field seperator, however string fields will be within double quotes and comma within double quotes should not be treated as field seperator. I am trying to replace this field seperator to a... (7 Replies)
Discussion started by: mk1216
7 Replies

7. UNIX Desktop Questions & Answers

awk Varing Field Separators

Hi Guys, I have small dilemma which I could do with a little help solving . I currently have text HDD S.M.A.R.T report which I have pasted below: smartctl 5.39 2008-10-24 22:33 (openSUSE RPM) Copyright (C) 2002-8 by Bruce Allen, http://smartmontools.sourceforge.net Device: COMPAQ... (2 Replies)
Discussion started by: bikerben
2 Replies

8. UNIX for Dummies Questions & Answers

Can one use 2 field separators in awk?

I have files such as n02-z30-dsr65-terr0.25-dc0.008-16x12drw-run1.cmd I am wondering if it is possible to define two field separators "-" and "." for these strings so that $7 is run1. (5 Replies)
Discussion started by: kristinu
5 Replies

9. Shell Programming and Scripting

Multiple long field separators

How do I use multiple field separators in awk? I know that if I use awk -F"", both a and b will be field separators. But what if I need two field separators that both are longer than one letter? If I want the field separators to be "ab" and "cd", I will not be able to use awk -F"". The ... (2 Replies)
Discussion started by: locoroco
2 Replies

10. Shell Programming and Scripting

Extract lines with min value, using two field separators.

I have a file with two ID columns followed by five columns of counts in fraction form. I'd like to print lines that have a count of at least 4 (so at least 4 in the numerator, e.g. 4/17) in at least one of the five columns. Input file: comp51820_c1_seq1 693 0/29 0/50 0/69 0/36 0/31... (6 Replies)
Discussion started by: pathunkathunk
6 Replies
resolv.conf(4)						     Kernel Interfaces Manual						    resolv.conf(4)

NAME
resolv.conf - Resolver configuration file SYNOPSIS
/etc/resolv.conf DESCRIPTION
The resolver is a set of routines in the C library (resolver(4)) that provide access to the Internet Domain Name System. The resolver con- figuration file contains information that is read by the resolver routines the first time they are invoked by a process. The file is designed to be human readable and contains a list of keywords with values that provide various types of resolver information. The keyword and value must appear on a single line, and the keyword (for example, nameserver) must start the line. The value follows the keyword, separated by white space. For example: keyword value The file format is as follows: nameserver Address Internet address (in dot notation) of a name server that the resolver should query. Up to MAXNS (currently 3) name servers may be listed, one per keyword. If there are multiple servers, the resolver library queries them in the order listed. If no nameserver 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, try the next, until out of name servers, then repeat trying all the name servers until a maximum number of retries are made). domain DomainName Local domain name. Most queries for names within this domain can use short names relative to the local domain. If no domain entry is present, the domain is determined from the local host name returned by gethostname(); the domain part is taken to be everything after the first . (dot). Finally, if the host name does not contain a domain part, the root domain is assumed. search Domain_Name1 DomainName2 ... Search list for host-name lookup. Up to six domains (separated by spaces or tabs) with a total of 256 characters can be specified. If no search entry is present, the search list consists of the local domain name. Most resolver queries will be attempted using each component of the search path in turn until a match is found. Note that this process may be slow and will generate a lot of network traffic if the servers for the listed domains are not local, and that queries will time out if no server is available for one of the domains. You can also specify a search list on a per-process basis by specifying the LOCALDOMAIN environment variable. See resolver(4). The domain and search keywords are mutually exclusive. If more than one instance of these keywords is present, the last instance will override. options allow_special all | { char } Option for defining valid characters in hostnames. Specify all to disable hostname checking (allow all characters) or define a set of valid characters by using the { char } syntax, where char is the character you want to allow. For example, you can allow the semicolon, underscore, and colon characters by using { ; \_ : }. Disabling hostname checking altogether is not recommended. By default, the allow_special option is not set and strict hostname checking is enforced. options ndots:n Option for hostname lookup. The n specifies the minimum number of dots a name must contain in order for resolver to look up the name as given. If the lookup fails, the search list (if specified) is applied. The range for n is from 0 to 15. If no options entry is present, the minimum number of dots is 1. You can also specify the number of dots on a per-process basis by using the RES_OPTIONS environment variable. See resolver(4). CAUTIONS
Any white space entered after the domain name is not ignored but is interpreted as part of the domain name. RELATED INFORMATION
Commands: named(8) Functions: gethostbyname(3), resolver(4) Files: hostname(5) delim off resolv.conf(4)
All times are GMT -4. The time now is 07:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy