I think the first variation should work fine for multiple surnames. Let me explain the solution:
1. I appended an asterisk '*' to the string (gender), i.e. the end of your record using sed by using
Here & is replaced by the matched string.
2. Then I divide the output of this command into records separated by '*' with fields separated by '/n' or newline character. This enables me to treat the four lines in each set as four different fields in the awk command. I achieve this by setting two variables:
3. Then, I simply match the second field (i.e. the second row of all sets) to the pattern
which matches fields starting with the string Smith followed by any character. In retrospect, the .* in the pattern is probably not needed.
Hi All,
I need to select only those records having a non zero record in the first column of a comma delimited file.
Suppose my input file is having data like:
"0","01/08/2005 07:11:15",1,1,"Created",,"01/08/2005"
"0","01/08/2005 07:12:40",1,1,"Created",,"01/08/2005"... (2 Replies)
As part of a bigger task, I had to read thru a file and separate records into various batches based on a field. Specifically, separate records based on the value in the batch field as defined below. The batch field left-justified numbers.
The datafile is here
> cat infile
12345 1 John Smith ... (5 Replies)
Dear list
its my first post and i would like to greet everyone
What i would like to do is select records 7 and 11 from each files in a folder then run an executable inside the script for the selected parameters.
The file format is something like this
7 100 200
7 100 250
7 100 300 ... (1 Reply)
Hi everyone.
I am a newbie to Linux stuff. I have this kind of problem which couldn't solve alone. I have a text file with records separated by empty lines like this:
ID: 20
Name: X
Age: 19
ID: 21
Name: Z
ID: 22
Email: xxx@yahoo.com
Name: Y
Age: 19
I want to grep records that... (4 Replies)
i have a table
records
------------
id | user | time | event
91 admin | 12:00 | hi
92 admin | 11:00 | hi
93 admin | 12:00 | bye
94 admin | 13:00 | bye
95 root | 12:00 | hi
96 root | 12:30 | hi
97 root | 12:56 | hi
how could i only select and display only the user and event from... (6 Replies)
Hello:
I am new to shell script programming. Now I would like to select specific records block from a file. For example, current file "xyz.txt" is containing 1million records and want to select the block of records from line number 50000 to 100000 and save into a file. Can anyone suggest me how... (3 Replies)
Print only records from file 2 that do not match file 1 based on criteria of comparing column 1 and column 6
Was trying to play around with following code I found on other threads but not too successful
Code:
awk 'NR==FNR{p=$1;$1=x;A=$0;next}{$2=$2(A?A:",,,")}1' FS=~ OFS=~ file1 FS="*"... (11 Replies)
Friends,
I have data sorted on id like this
id addressl
1 abc
2 abc
2 abc
2 abc
3 aabc
4 abc
4 abc
I want to pick all ids with addressesses leaving out duplicate records. Desired output would be
id address
1 abc
2 abc
3 abc
4 abc (5 Replies)
Hi All
I would like to modify a file like this:
>antax gioq21 tris notes
abcdefghij
klmnopqrs
>betax gion32 ter notes2
tuvzabcdef
ahgskslsooin this:
>tris
abcdefghij
klmnopqrs
>ter
tuvzabcdef
ahgskslsoo
So, I would like to remove the first two fields(and output field 3) in record... (4 Replies)
I have a file, named records.txt, containing large number of records, around 0.5 million records in format below:
28433005 1 1 3 2 2 2 2 2 2 2 2 2 2 2
28433004 0 2 3 2 2 2 2 2 2 1 2 2 2 2
...
Another file is a key file, named key.txt, which is the list of some numbers in the first column of... (5 Replies)
Discussion started by: zenongz
5 Replies
LEARN ABOUT DEBIAN
amanda-archive-format
AMANDA-ARCHIVE-FOR(5) File formats and conventions AMANDA-ARCHIVE-FOR(5)NAME
amanda-archive-format - Format of amanda archive streams
DESCRIPTION
The Amanda archive format is designed to be a simple, efficient means of interleaving multiple simultaneous files, allowing an arbitrary
number of data streams for a file. It is a streaming format in the sense that the writer need not know the size of files until they are
completely written to the archive, and the reader can process the archive in constant space.
DATA MODEL
The data stored in an archive consists of an unlimited number of files. Each file consists of a number of "attributes", each identified by
a 16-bit ID. Each attribute can contain an unlimited amount of data.
Attribute IDs less than 16 (AMAR_ATTR_APP_START) are reserved for special purposes, but the remaining IDs are available for
application-specific uses.
STRUCTURE
RECORDS
A record can be either a header record or a data record. A header record serves as a "checkpoint" in the file, with a magic value that can
be used to recognize archive files.
A header record has a fixed size of 28 bytes, as follows:
28 bytes: magic string
The magic string is the ASCII text "AMANDA ARCHIVE FORMAT " followed by a decimal representation of the format version number (currently
'1'), padded to 28 bytes with NUL bytes.
A data record has a variable size, as follows:
2 bytes: file number
2 bytes: attribute ID
4 bytes: data size (N)
N bytes: data
The file number and attribute ID serve to identify the data stream to which this data belongs. The low 31 bits of the data size give the
number of data bytes following, while the high bit (the EOA bit) indicates the end of the attribute, as described below. Because records
are generally read into memory in their entirety, the data size must not exceed 4MB (4194304 bytes). All integers are in network byte
order.
A header record is distinguished from a data record by the magic string. The file number 0x414d, corresponding to the characters "AM", is
forbidden and must be skipped on writing.
Attribute ID 0 (AMAR_ATTR_FILENAME) gives the filename of a file. This attribute is mandatory for each file, must be nonempty, must fit in
a single record, and must precede any other attributes for the same file in the archive. The filename should be a printable string (ASCII
or UTF-8), to facilitate use of generic archive-display utilities, but the format permits any nonempty bytestring. The filename cannot span
multiple records.
Attribute ID 1 (AMAR_ATTR_EOF) signals the end of a file. This attribute must contain no data, but should have the EOA bit set.
CONNECTION TO DATA MODEL
Each file in an archive is assigned a file number distinct from any other active file in the archive. The first record for a file must have
attribute ID 0 (AMAR_ATTR_FILENAME), indicating a filename. A file ends with an empty record with ID 1 (AMAR_ATTR_EOF). For every file at
which a reader might want to begin reading, the filename record should be preceded by a header record. How often to write header records is
left to the discretion of the application.
All data records with the same file number and attribute ID are considered a part of the same attribute. The boundaries between such
records are not significant to the contents of the attribute, and both readers and writers are free to alter such boundaries as necessary.
The final data record for each attribute has the high bit (the EOA bit) of its data size field set. A writer must not reuse an attribute ID
within a file. An attribute may be terminated by a record containing both data and an EOA bit, or by a zero-length record with its EOA bit
set.
SEE ALSO amanda(8), amanda(8)
The Amanda Wiki: : http://wiki.zmanda.com/
AUTHOR
Dustin J. Mitchell <dustin@zmanda.com>
Zmanda, Inc. (http://www.zmanda.com)
Amanda 3.3.1 02/21/2012 AMANDA-ARCHIVE-FOR(5)