Sponsored Content
Top Forums Shell Programming and Scripting Sort based on positions in flat file Post 302876607 by RudiC on Monday 25th of November 2013 03:11:11 PM
Old 11-25-2013
Please use code tags as required by forum rules!

You seem to have edited your initial post#1 after the comments of Don Cragun. Still, due to missing code tags, your input sample does NOT obey the specification (field positions) that you have given. Plus, the desired output does NOT conform to your specs, either - it is sorted for last name, not first name as desired. Try this (based on guesses and input modified by me to be reasonable) and come back with results/comments:
Code:
sort -k1.8,1.15 -k1.1,1.6 -k1.21,1.29n file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Sorting a flat file based on multiple colums(using character position)

Hi, I have an urgent task here. I am required to sort a flat file based on multiple columns which are based on the character position in that line. I am restricted to use the character position instead of the space and sort +1 +2 etc to do the sorting. I understand that there is a previous... (8 Replies)
Discussion started by: cucubird
8 Replies

2. Shell Programming and Scripting

Merge lines in Flat file based on first 5 characters

Hi I have the fixed width flat file having the following data 12345aaaaaaaaaabbbbbbbbbb 12365sssssssssscccccccccc 12365sssss 12367ddddddddddvvvvvvvvvv 12367 vvvvv Here the first column is length 5 second is length 10 third is length 10 if the second or third column exceeds... (3 Replies)
Discussion started by: Brado
3 Replies

3. Shell Programming and Scripting

Shell script to email based on flat file output

Hi All, I am a newbee in unix but still have written a shell script which should trigger a mail based on certain conditions but the problem is that my file is not being read. Below is the code please advise. I do not know where is it failing. Note $ and the no followed with it is the no of... (1 Reply)
Discussion started by: apoorva
1 Replies

4. Shell Programming and Scripting

Filling positions based on consensus character

I have files with hundreds of sequences with missing characters represented by a dash ("-"), something like this I need to go sequence by sequence and if a dash is found, it should be replaced with the most common character in that particular position. Thus, in my example the dash in the second... (6 Replies)
Discussion started by: Xterra
6 Replies

5. Shell Programming and Scripting

seds to extract fields based on positions

Hi My file has a series of rows up to 160 characters in length. There are 7 columns for each row. In each row, column 1 starts at position 4 column 2 starts at position 12 column 3 starts at position 43 column 4 starts at position 82 column 5 starts at... (7 Replies)
Discussion started by: malts18
7 Replies

6. Shell Programming and Scripting

Sort flat file by 3rd column in perl

Hello Guys I want to sort a flat file by the third column (numeric ) and store it in some other name I/P 9924873|20111114|00000000000013013|130|13|10/15/2010 12:36:22|W860944|N|00 9924873|20111114|00000000000013009|130|09|10/15/2010 12:36:22|W860944|N|00... (12 Replies)
Discussion started by: Pratik4891
12 Replies

7. Shell Programming and Scripting

Getting data from a flat file based on condition

Hi, I have a flaty file from which i am fetching few columns in tablular form as below code. Now i want to fetch the column 6 and 7 in below code only if it either of them is non zero.However below startement awk -F, '$6==0 && $7==0{exit 1}' ${IFILE} is not working..Not sure where is the... (36 Replies)
Discussion started by: Vivekit82
36 Replies

8. Shell Programming and Scripting

Join based on positions

I have two text files as shown below cat file1.txt Id leng sal mon 25671 34343 56565 5565 44888 56565 45554 6868 23343 23423 26226 6224 77765 88688 87464 6848 66776 23343 63463 4534 cat file2.txt Id number 25671 34343 76767 34234 23343 23423 66776 23343 (4 Replies)
Discussion started by: halfafringe
4 Replies

9. UNIX for Dummies Questions & Answers

Filling positions based on frequency

I have files with hundreds of sequences with frequency values reported as "Freq X" and missing characters represented by a dash ("-"), something like this >39sample Freq 4 TAGATGTGCCCGTGGGTTTCCCGTCAACACCGGATAGTAGCAGCACTA >22sample Freq 15 T-GATGTCGTGGGTTTCCCGTCAACACCGGCAAATAGTAGCAGCACTA... (12 Replies)
Discussion started by: Xterra
12 Replies

10. Shell Programming and Scripting

Filter lines based on values at specific positions

hi. I have a Fixed Length text file as input where the character positions 4-5(two character positions starting from 4th position) indicates the LOB indicator. The file structure is something like below: 10126Apple DrinkOmaha 10231Milkshake New Jersey 103 Billabong Illinois ... (6 Replies)
Discussion started by: kumarjt
6 Replies
TIFFReadDirectory(3tiff)												  TIFFReadDirectory(3tiff)

NAME
TIFFReadDirectory - get the contents of the next directory in an open TIFF file SYNOPSIS
#include <tiffio.h> int TIFFReadDirectory(TIFF* tif) Read the next directory in the specified file and make that the current directory. Applications only need to call TIFFReadDirectory to read multiple subfiles in a single TIFF file. The first directory in a file is automatically read when TIFFOpen is called. If the library is compiled with STRIPCHOP_SUPPORT enabled, then images that have a single uncompressed strip or tile of data are automati- cally treated as if they were made up of multiple strips or tiles of approximately 8 kilobytes each. This operation is performed only in- memory and does not alter the contents of the file. However, the construction of the "chopped strips" is visible to the application through the number of strips [tiles] returned by TIFFNumberOfStrips [TIFFNumberOfTiles]. Diagnostics All error messages are directed to the TIFFError(3tiff) routine. All warning messages are directed to the TIFFWarning(3tiff) routine. Seek error accessing TIFF directory. An error occurred while positioning to the location of the directory. Wrong data type %d for field "%s". The tag entry in the directory had an incorrect data type. For example, an ImageDescription tag with a SHORT data type. TIFF directory is missing required "%s" field. The specified tag is required by the TIFF 5.0 specification to be present, but is missing. The directory is usually unusable. %s: Rational with zero denominator. A directory tag has a RATIONAL value whose denominator is zero. Incorrect count %d for field "%s" (%lu, expecting %lu); tag ignored. The count field for the specified tag is bad. For example, a count other than 1 for a SubFileType tag. Cannot handle different per-sample values for field "%s". The tag has SamplesPerPixel values that are not all the same. For example, BitsPerSample. The library is unable to manage images of this sort. Count mismatch for field "%s"; expecting %d, got %d. The count field in a tag does not agree with the number expected by the library. This should never happen. If this situation occurs, the library refuses to read the directory. Invalid TIFF directory; tags are not sorted in ascending order. The directory tags are not properly sorted as specified in the TIFF 5.0 specification. This error is not fatal. Ignoring unknown field with tag %d (0x%x). An unknown tag was encountered in the directory. The library ignores all such tags. TIFF directory is missing required "ImageLength" field. The image violates the specification by not having a necessary field. The library cannot recover from this error. TIFF directory is missing required "PlanarConfig" field. The image violates the specification by not having a necessary field. The library cannot recover from this error. TIFF directory is missing required "StripOffsets" field. The image has multiple strips, but does not have the tag that specifies the file offset to each strip of data. The library cannot recover from this error. TIFF directory is missing required "TileOffsets" field. The image has multiple tiles, but does not have the tag that specifies the file offset to each tile of data. The library cannot recover from this error. TIFF directory is missing required "StripByteCounts" field. The image has multiple strips, but does not have the tag that specifies the size of each strip of data. The library cannot recover from this error. TIFF directory is missing required "StripByteCounts" field, calculating from imagelength. The image violates the specification by not having a necessary field. However, when the image is comprised of only one strip or tile, the library estimates the missing value based on the file size. Bogus "StripByteCounts" field, ignoring and calculating from imagelength. Certain vendors violate the specification by writing zero for the StripByteCounts tag when they want the value to remain unspecified. If the image has a single strip, the library estimates the missing value based on the file size. If the next directory was successfully read, 1 is returned. Otherwise, 0 is returned if an error was encountered, or if there are no more directories to be read. See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWTiff | +-----------------------------+-----------------------------+ |Interface stability |Uncommitted | +-----------------------------+-----------------------------+ libtiff(3), TIFFOpen(3tiff), TIFFWriteDirectory(3tiff), TIFFSetDirectory(3tiff), TIFFSetSubDirectory(3tiff) This man page was originally written by Sam Leffler. Updated by Breda McColgan, Sun Microsystems Inc., 2004. 05 Apr 2004 TIFFReadDirectory(3tiff)
All times are GMT -4. The time now is 10:50 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy