Is this what you were trying to do? You don't have to use nawk.
if its a very large file as OP mentioned, running each line through a while loop and echoing part of each through sed might not be that efficient. it might be better to eliminate the while loop and let sed iterate the file instead since sed is internally "looping" over files anyway.
Also, awk is specifically designed to process structured data so it understands fields. using awk might be more "appropriate" in OP's case.
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)
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)
I need to print the second field of a file, taking spaces, tab and = as field separators.
; for 16-bit app support
MAPI=1
CMC=1
CMCDLLNAME32=mapi32.dll
CMCDLLNAME=mapi.dll
MAPIX=1
MAPIXVER=1.0.0.1
OLEMessaging=1
asf=MPEGVideo
asx=MPEGVideo
ivf=MPEGVideo
m3u=MPEGVideo (2 Replies)
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)
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)
I am trying to figure out a way in nawk to 1) get a count of the number of times a value appears in field 1 and 2) count each time the same value appears in field 2 for each value of field 1. So for example, if I have a text file with the following:
grapes, purple
apples, green
squash, yellow... (2 Replies)
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)
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)
Can you please help me with this ....
Input File
share "FTPTransfer" "/v31_fs01/root/FTP-Transfer" umask=022 maxusr=4294967295 netbios=NJ09FIL530
share "Test" "/v31_fs01/root/Test" umask=022 maxusr=4294967295 netbios=NJ09FIL530
share "ENR California" "/v31_fs01/root/ENR California"... (14 Replies)
I have a large file that I need to print certain sections out of.
file.txt
/alpha/beta/delta/gamma/425/590/USC00015420.blah.lt.0.01.str:USC00015420Y2017M10BLALT.01 12 13 14 -9 1 -9 -9 -9 -9 -9 1 2 3 4 5 -9 -9
I need to print the "USC00015420" and... (5 Replies)
Discussion started by: ncwxpanther
5 Replies
LEARN ABOUT HPUX
join
join(1) General Commands Manual join(1)NAME
join - relational database operator
SYNOPSIS
[options] file1 file2
DESCRIPTION
forms, on the standard output, a join of the two relations specified by the lines of file1 and file2. If file1 or file2 is the standard
input is used.
file1 and file2 must be sorted in increasing collating sequence (see Environment Variables below) on the fields on which they are to be
joined; normally the first in each line.
The output contains one line for each pair of lines in file1 and file2 that have identical join fields. The output line normally consists
of the common field followed by the rest of the line from file1, then the rest of the line from file2.
The default input field separators are space, tab, or new-line. In this case, multiple separators count as one field separator, and lead-
ing separators are ignored. The default output field separator is a space.
Some of the below options use the argument n. This argument should be a or a referring to either file1 or file2, respectively.
Options
In addition to the normal output,
produce a line for each unpairable line in file n, where n is or
Replace empty output fields by string
s.
Join on field
m of both files. The argument m must be delimited by space characters. This option and the following two are provided for
backward compatibility. Use of the and options ( see below ) is recommended for portability.
Join on field
m of file1.
Join on field
m of file2.
Each output line comprises the fields specified in
list, each element of which has the form where n is a file number and m is a field number. The common field is not printed
unless specifically requested.
Use character
c as a separator (tab character). Every appearance of c in a line is significant. The character c is used as the field sepa-
rator for both input and output.
Instead of the default output,
produce a line only for each unpairable line in file_number, where file_number is or
Join on field
f of file 1. Fields are numbered starting with 1.
Join on field
f of file 2. Fields are numbered starting with 1.
EXTERNAL INFLUENCES
Environment Variables
determines the collating sequence expects from input files.
determines the alternative blank character as an input field separator, and the interpretation of data within files as single and/or multi-
byte characters. also determines whether the separator defined through the option is a single- or multi-byte character.
If or is not specified in the environment or is set to the empty string, the value of is used as a default for each unspecified or empty
variable. If is not specified or is set to the empty string, a default of ``C'' (see lang(5)) is used instead of If any internationaliza-
tion variable contains an invalid setting, behaves as if all internationalization variables are set to ``C'' (see environ(5)).
International Code Set Support
Single- and multi-byte character code sets are supported with the exception that multi-byte-character file names are not supported.
EXAMPLES
The following command line joins the password file and the group file, matching on the numeric group ID, and outputting the login name, the
group name, and the login directory. It is assumed that the files have been sorted in the collating sequence defined by the or environment
variable on the group ID fields.
The following command produces an output consisting all possible combinations of lines that have identical first fields in the two sorted
files sf1 and sf2, with each line consisting of the first and third fields from and the second and fourth fields from
WARNINGS
With default field separation, the collating sequence is that of with the sequence is that of a plain sort.
The conventions of and are incongruous.
Numeric filenames may cause conflict when the option is used immediately before listing filenames.
AUTHOR
was developed by OSF and HP.
SEE ALSO awk(1), comm(1), sort(1), uniq(1).
STANDARDS CONFORMANCE join(1)