Sponsored Content
Full Discussion: Sorting by length
Top Forums Shell Programming and Scripting Sorting by length Post 302724721 by ripat on Thursday 1st of November 2012 08:08:57 AM
Old 11-01-2012
awk oneliner alternative

Code:
awk '{w[length] = w[length] ? w[length]"\n"$0 : $0} END {for(l in w) print w[l]}' file

This User Gave Thanks to ripat For This Post:
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

creating a fixed length output from a variable length input

Is there a command that sets a variable length? I have a input of a variable length field but my output for that field needs to be set to 32 char. Is there such a command? I am on a sun box running ksh Thanks (2 Replies)
Discussion started by: r1500
2 Replies

2. UNIX for Dummies Questions & Answers

Sed working on lines of small length and not large length

Hi , I have a peculiar case, where my sed command is working on a file which contains lines of small length. sed "s/XYZ:1/XYZ:3/g" abc.txt > xyz.txt when abc.txt contains lines of small length(currently around 80 chars) , this sed command is working fine. when abc.txt contains lines of... (3 Replies)
Discussion started by: thanuman
3 Replies

3. UNIX for Dummies Questions & Answers

What the command to find out the record length of a fixed length file?

I want to find out the record length of a fixed length file? I forgot the command. Any body know? (9 Replies)
Discussion started by: tranq01
9 Replies

4. UNIX for Dummies Questions & Answers

Conditional sorting on fixed length flat file

I have a fixed length file that need to be sorted according to the following rule IF B=1 ORDER by A,B Else ORDER by A,C Input file is ABC 131 112 122 231 212 222 Output needed ABC 112 131 122 212 231 222 (1 Reply)
Discussion started by: zsk_00
1 Replies

5. UNIX for Dummies Questions & Answers

Sorting words based on length

i need to write a bash script that recive a list of varuables kaka pele ronaldo beckham zidane messi rivaldo gerrard platini i need the program to print the longest word of the list. word in the output appears on a separate line and word order in the output is in the order Llachsicografi costs.... (1 Reply)
Discussion started by: yairpg
1 Replies

6. Shell Programming and Scripting

Flat file-make field length equal to header length

Hello Everyone, I am stuck with one issue while working on abstract flat file which i have to use as input and load data to table. Input Data- ------ ------------------------ ---- ----------------- WFI001 Xxxxxx Control Work Item A Number of Records ------ ------------------------... (5 Replies)
Discussion started by: sonali.s.more
5 Replies

7. Shell Programming and Scripting

Sorting on length with identification of number of characters

Hello, I am writing an open-source stemmer in Java for Indic languages which admit a large number of suffixes. The Java stemmer requires that each suffix string be sorted as per its length and that all strings of the same length are arranged in a single group, sorted alphabetically. Moreover as a... (3 Replies)
Discussion started by: gimley
3 Replies

8. Shell Programming and Scripting

Sorting a file with frequency on length

Hello, I have a file which has the following structure word space Frequency The file is around 30,000 headwords each along with its frequency. The words have different lengths. What I need is a PERL or AWK script which can sort the file on length of the headword and once the file is sorted on... (12 Replies)
Discussion started by: gimley
12 Replies

9. Shell Programming and Scripting

Convert variable length record to fixed length

Hi Team, I have an issue to split the file which is having special chracter(German Char) using awk command. I have a different length records in a file. I am separating the files based on the length using awk command. The command is working fine if the record is not having any... (7 Replies)
Discussion started by: Anthuvan
7 Replies
CWNN(7) 						 Miscellaneous Information Manual						   CWNN(7)

NAME
cWnn - A Chinese Input System Running on Unix Workstations. DESCRIPTION
cWnn provides a wide range of input methods, satisfying the needs of Chinese users all over the world, including P.R.China and Taiwan. Besides, it is capable of converting an arbitrary sequence of Pinyin/Zhuyin into the expected Hanzi and caters for error tolerance in the four tones. cWnn has standardized Pinyin and Zhuyin and it provides an ideal input environment for all users. COMMANDS AVAILABLE IN MAN FILE
1. Startup of the server - cserver 2. Startup of the front-end processor - cuum 3. Current usage status of the server - cwnnstat 4. Termination of the server - cwnnkill 5. Rewrite of dictionary header - cwnntouch UTILITIES AVAILABLE IN MAN FILE
1. Creation of binary format dictionary - catod 2. Restoration of text format dictionary - cdtoa 3. Creation of binary format grammar file - catof 4. Registration of characters/words into a - cwdreg specified dictionary 5. Deletion of characters/words from a specified - cwddel dictionary 6. Sorting of a specified text format dictionary - cdicsort MISCELLANEOUS INFORMATION
1. cWnn installation - cinstall 2. cWnn startup and termination - cstartend 3. cWnn function keys - ckey 4. cWnn environment operation function - cenv 13 May 1992 CWNN(7)
All times are GMT -4. The time now is 12:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy