Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Cut specific fields from a file containing multiline records Post 302306272 by sunayana3112 on Sunday 12th of April 2009 04:56:19 AM
Old 04-12-2009
Cut specific fields from a file containing multiline records

Hi,
I am looking for a method to get column13 to column 50 data from the 1st line of a multiline reord. The records are stored in a large file and are separated by newline. sample format is

(data in red is to be extracted)

<header>

A001dfhskhfkdsh hajfhksdhfjh shdfhsdfhkjldsfhslkjlshdfsdlfhsd;lh
A002skdjfkjsdkfj kjafjdsljfpok;fjdskf;kldsjfposifpsjdf
A003jlskjfslkfjsljf ;dfs;ksjg
A004sdfhskjlfhlshf jhsfhskjldhfjs

A001dfhskhfkdsh hajfhksdhfjh shdfhsdfhkjldsfhslkjlshdfsdlfhsd;lh
A002skdjfkjsdkfj kjafjdsljfpok;fjdskf;kldsjfposifpsjdf
A003jlskjfslkfjsljf ;dfs;ksjg
A004sdfhskjlfhlshf jhsfhskjldhfjs
.....

<trailer>
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

cut specific records from a file

I am trying to cut the first 10 characters from a file only if the file has 'xyz' in field 185-188. I tried this cat filename | cut -c1-10 but this gives me all the records regardless of what is in field 185-188. Is this doable ? Thanks in advance for responses. (2 Replies)
Discussion started by: jxh461
2 Replies

2. Shell Programming and Scripting

Awk Compare Files w/Multiline Records

I'm trying to compare the first column values in two different files that use a numerical value as the key and output the more meaningful value found in the second column of file1 in front of the matching line(s) in file2. My problem is that file2 has multiple records. For example given: FILE1... (4 Replies)
Discussion started by: RacerX
4 Replies

3. Shell Programming and Scripting

Extracting records with unique fields from a fixed width txt file

Greetings, I would like to extract records from a fixed width text file that have unique field elements. Data is structured like this: John A Smith NY Mary C Jones WA Adam J Clark PA Mary Jones WA Fieldname / start-end position Firstname 1-10... (8 Replies)
Discussion started by: sitney
8 Replies

4. UNIX for Dummies Questions & Answers

AWK ??-print for fields within records in a file

Hello all, Would appreciate if someone can help me out on the following requirement. INPUT FILE: -------------------------- TPS REPORT abc def ghi jkl mon pqr stu vrs lll END OF TPS REPORT TPS REPORT field1 field2 field3 field4 field5 field6 (8 Replies)
Discussion started by: hyennah
8 Replies

5. Shell Programming and Scripting

compare fields in a file with duplicate records

Hi: I've been searching the net but didnt find a clue. I have a file in which, for some records, some fields coincide. I want to compare one (or more) of the dissimilar fields and retain the one record that fulfills a certain condition. For example, on this file: 99 TR 1991 5 06 ... (1 Reply)
Discussion started by: rleal
1 Replies

6. Shell Programming and Scripting

awk sed cut? to rearrange random number of fields into 3 fields

I'm working on formatting some attendance data to meet a vendors requirements to upload to their system. With some help on the forums here, I have the data close. But they've since changed what they want. The vendor wants me to submit three fields to them. Field 1 is the studentid field,... (4 Replies)
Discussion started by: axo959
4 Replies

7. Shell Programming and Scripting

how to cut fields in file

Hi, I have data in following format. 10001, John, Daves, Architecture, -2219 10002, Jim, Cirners, Businessman, -2219 1003, Tom, Katch, Engineer, -14003 I want to select the last column of the above given file and paste it on a different file in the following manner. File TEST column... (11 Replies)
Discussion started by: kam786sim
11 Replies

8. Shell Programming and Scripting

Cut 2 fields and write to a output file

Hi, I am writing a code where the file is a pipe delimited and I would need to extract the 2nd part of field2 if it is "ATTN", "C/O" or "%" and check to see if field9 is populated or not. If field9 is already populated then leave it as is but if field9 is not populated then take the 2nd part of... (3 Replies)
Discussion started by: msalam65
3 Replies

9. UNIX for Dummies Questions & Answers

Grep specific records from a file of records that are separated by an empty line

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)
Discussion started by: Atrisa
4 Replies

10. Shell Programming and Scripting

Cut fields from /etc/passwd file into variables?

The script must ask the user to enter the user name and check whether the user exists in /etc/passwd (you must allow the partial usernames also). If the username exists, display the details as: List of users Login Name: User ID: ... (3 Replies)
Discussion started by: nobletechnology
3 Replies
deb-changes(5)							    dpkg suite							    deb-changes(5)

NAME
deb-changes - Debian changes file format SYNOPSIS
filename.changes DESCRIPTION
Each Debian upload is composed of a .changes control file, which contains a number of fields. Each field begins with a tag, such as Source or Binary (case insensitive), followed by a colon, and the body of the field. Fields are delimited only by field tags. In other words, field text may be multiple lines in length, but the installation tools will generally join lines when processing the body of the field (except in case of the multiline fields Description, Changes, Files, Checksums-Sha1 and Checksums-Sha256, see below). The control data might be enclosed in an OpenPGP ASCII Armored signature, as specified in RFC4880. FIELDS
Format: format-version (required) The value of this field declares the format version of the file. The syntax of the field value is a version number with a major and minor component. Backward incompatible changes to the format will bump the major version, and backward compatible changes (such as field additions) will bump the minor version. The current format version is 1.8. Date: release-date (required) The date the package was built or last edited. It must be in the same format as the date in a deb-changelog(5) entry. The value of this field is usually extracted from the debian/changelog file. Source: source-name [(source-version)] (required) The name of the source package. If the source version differs from the binary version, then the source-name will be followed by a source-version in parenthesis. This can happen when the upload is a binary-only non-maintainer upload. Binary: binary-package-list (required) This folded field is a space-separated list of binary packages to upload. Architecture: arch-list Lists the architectures of the files currently being uploaded. Common architectures are amd64, armel, i386, etc. Note that the all value is meant for packages that are architecture independent. If the source for the package is also being uploaded, the special entry source is also present. Architecture wildcards must never be present in the list. Version: version-string (required) Typically, this is the original package's version number in whatever form the program's author uses. It may also include a Debian revision number (for non-native packages). The exact format and sorting algorithm are described in deb-version(7). Distribution: distributions (required) Lists one or more space-separated distributions where this version should be installed when it is uploaded to the archive. Urgency: urgency (recommended) The urgency of the upload. The currently known values, in increasing order of urgency, are: low, medium, high, critical and emergency. Maintainer: fullname-email (required) Should be in the format "Joe Bloggs <jbloggs@example.org>", and is typically the person who created the package, as opposed to the author of the software that was packaged. Changed-By: fullname-email Should be in the format "Joe Bloggs <jbloggs@example.org>", and is typically the person who prepared the package changes for this release. Description: (recommended) binary-package-name - binary-package-summary This multiline field contains a list of binary package names followed by a space, a dash ('-') and their possibly truncated short descriptions. Closes: bug-number-list A space-separated list of bug report numbers that have been resolved with this upload. The distribution archive software might use this field to automatically close the referred bug numbers in the distribution bug tracking system. Binary-Only: yes This field denotes that the upload is a binary-only non-maintainer build. It originates from the binary-only=yes key/value from the changelog matadata entry. Built-For-Profiles: profile-list This field specifies a whitespace separated list of build profiles that this upload was built with. Changes: (required) changelog-entries This multiline field contains the concatenated text of all changelog entries that are part of the upload. To make this a valid multiline field empty lines are replaced with a single full stop ('.') and all lines are indented by one space character. The exact content depends on the changelog format. Files: (required) md5sum size section priority filename This multiline field contains a list of files with an md5sum, size, section and priority for each one. The first line of the field value (the part on the same line as the field name followed by a colon) is always empty. The content of the field is expressed as continuation lines, one line per file. Each line consists of space-separated entries describing the file: the md5sum, the file size, the file section, the file priority, and the file name. This field lists all files that make up the upload. The list of files in this field must match the list of files in the other related Checksums fields. Checksums-Sha1: (required) Checksums-Sha256: (required) checksum size filename These multiline fields contain a list of files with a checksum and size for each one. These fields have the same syntax and differ only in the checksum algorithm used: SHA-1 for Checksums-Sha1 and SHA-256 for Checksums-Sha256. The first line of the field value (the part on the same line as the field name followed by a colon) is always empty. The content of the field is expressed as continuation lines, one line per file. Each line consists of space-separated entries describing the file: the checksum, the file size, and the file name. These fields list all files that make up the upload. The list of files in these fields must match the list of files in the Files field and the other related Checksums fields. BUGS
The Files field is inconsistent with the other Checksums fields. The Change-By and Maintainer fields have confusing names. The Distribution field contains information about what is commonly referred to as a suite. SEE ALSO
deb-src-control(5), deb-version(7). 1.19.0.5 2018-04-16 deb-changes(5)
All times are GMT -4. The time now is 12:20 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy