Sponsored Content
Top Forums Shell Programming and Scripting sort -t option causing code to fail need ASCII character Post 302526942 by kumaran_5555 on Thursday 2nd of June 2011 02:58:09 AM
Old 06-02-2011
By default sort takes white space chars as delimiter, in your case you fields only delimited by tab, so you don't have to specif any delimiter, I have executed on solaris, it worked fine for me
Code:
user@host> (/home/user) $ sort  -k1,1 -k2,2 -k4,4 -k5,5r test.txt >sorted.txt
user@host> (/home/user) $ sort  -k1,1 -k2,2 -k4,4  sorted.txt -u
11erescca    010240    06    10    sct_det3_901_20110517_143936.txt
21erescca    010240    4    10    sct_det3_10_20110517_143936.txt
21erescca    010245    8    10    sct_det3_10_20110516_143936.txt
41erescca    010240    6    10    sct_det3_10_20110517_143936.txt
41erescca    4010240    6    10    sct_det3_10_20110517_143936.txt
user@host> (/home/user) $ cat sorted.txt
11erescca    010240    06    10    sct_det3_901_20110517_143936.txt
11erescca    010240    1    10    sct_det3_901_20110516_143936.txt
11erescca    010240    2    10    sct_det3_10_20110516_143936.txt
11erescca    010240    2    10    sct_det3_10_20110516_143936.txt
21erescca    010240    4    10    sct_det3_10_20110517_143936.txt
21erescca    010240    8    10    sct_det3_10_20110516_143936.txt
21erescca    010245    8    10    sct_det3_10_20110516_143936.txt
41erescca    010240    6    10    sct_det3_10_20110517_143936.txt
41erescca    010240    7    10    sct_det3_10_20110516_143936.txt
41erescca    4010240    6    10    sct_det3_10_20110517_143936.txt

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Environment variables causing cronjob to fail

I am trying to run a script which makes use of these environment variables, hence i need to export them out. i've posted a similar post in an oracle forum. I've posted the same qn here to get some advise on the scripting aspect. i execute my program in an unix environment by typeing... (2 Replies)
Discussion started by: new2ss
2 Replies

2. UNIX for Dummies Questions & Answers

curl and --fail option

--fail seems to not be working in cURL. When using cURL to download multiple files, --fail is supposed to keep cURL from making files that don't exist, on 404 errors. But when I use --fail or -f, it still makes those files. I've tried it on both Cygwin cURL and Win32 cURL. Anyone know anything... (2 Replies)
Discussion started by: Pulseczar
2 Replies

3. UNIX for Dummies Questions & Answers

Ascii value of character?

Is there a way to determine the ascii value of a character? For example, let's say a shell variable has the value 'A'. I would like it's ascii value (e.g. 65 in this case). I would like to do this from a script (preferably ksh). (12 Replies)
Discussion started by: sszd
12 Replies

4. Shell Programming and Scripting

read in a file character by character - replace any unknown ASCII characters with spa

Can someone help me to write a script / command to read in a file, character by character, replace any unknown ASCII characters with space. then write out the file to a new filename/ Thanks! (1 Reply)
Discussion started by: raghav525
1 Replies

5. Shell Programming and Scripting

perl sort unicode non-ascii letters

In another thread (field separator in Perl) I nearly solved my sorting problem and I finally understood the Schwartzian transform especially thank to KevinADC. After that I've found out that the sorting was not done the way I need it. I did not notice it at first because I used all vowels as a... (6 Replies)
Discussion started by: ahsog
6 Replies

6. UNIX for Advanced & Expert Users

ASCII Character Set

I thought I would point this out. This has a lot of the non printing characters. ASCII Character Set (7 Replies)
Discussion started by: cokedude
7 Replies

7. UNIX for Dummies Questions & Answers

How to grep for a non-standard ASCII character?

A very simple question but I have scoured the web and can't find an answer. How do I search for a character by ASCII code in a regular expression using grep? For example, we use the End of Medium symbol as a delimiter in certain files. (this is ascii 031 in oct, displays as ^Y) I want to grep... (6 Replies)
Discussion started by: DJR
6 Replies

8. Shell Programming and Scripting

Print the next ASCII character

Hi, In my file, for few field I have to print the next ASCII character for every character. In the below file, I have to do for the 2,3 and 5th fields. Input File ======== 1|abc|def|5|ghi 2|jkl|mno|6|pqr Expected Ouput file ======= 1|bcd|efg|5|hij 2|klm|nop|6|qrs (2 Replies)
Discussion started by: machomaddy
2 Replies

9. UNIX for Advanced & Expert Users

Veritas Cluster automatic fail-back option on Solaris

Hi - Please help me to understand the Veritas Cluster fail-over capability. We configured oracle database file system on veritas cluster file system and it is automatically failing-over from node 1 to node 2. Does Veritas cluster softward have any option to fail-back from node 2 to node 1... (6 Replies)
Discussion started by: Mansoor8810
6 Replies

10. UNIX for Dummies Questions & Answers

What is ASCII character?

Hi Guru, I have put one post yesterday and get answer. thanks for your help. my question today is: what is ascii character for following non printable characters: ( we need filter these characters out in another process) ^MM-^E^MM-^E. Old post link: ... (5 Replies)
Discussion started by: ken002
5 Replies
Text::BibTeX::BibSort(3pm)				User Contributed Perl Documentation				Text::BibTeX::BibSort(3pm)

NAME
Text::BibTeX::BibSort - generate sort keys for bibliographic entries SYNOPSIS
# Assuming $entry comes from a database of the 'Bib' structure # (i.e., that it's blessed into the BibEntry class, which inherits # the sort_key method from BibSort): $sort_key = $entry->sort_key; DESCRIPTION
"Text::BibTeX::BibSort" is a base class of "Text::BibTeX::BibEntry" for generating sort keys from bibliography entries. It could in principle (and, someday, might) offer a wide range of highly customizable sort-key generators. Currently, though, it provides only a single method ("sort_key") for public use, and that method only pays attention to one structure option, "sortby". METHODS
sort_key () Generates a sort key for a single bibliographic entry. Assumes this entry conforms to the "Bib" database structure. The nature of this sort key is controlled by the "sortby" option, which can be either "name" or "year". (The "namestyle" also has a role, in determining how author/editor names are formatted for inclusion in the sort key.) For by-name sorting (which is how BibTeX's standard styles work), the sort key consists of one of the "author", "editor", "organization", or "key" fields (depending on the entry type and which fields are actually present), followed by the year and the title. All fields are drastically simplified to produce the sort key: non-English letters are mercilessly anglicized, non-alphabetic characters are stripped, and everything is forced to lowercase. (The first two steps are done by the "purify_string" routine; see "Generic string-processing functions" in Text::BibTeX for a brief description, and the descripton of the C function "bt_purify_string()" in bt_misc for all the gory details.) SEE ALSO
Text::BibTeX::Structure, Text::BibTeX::Bib, Text::BibTeX::BibFormat AUTHOR
Greg Ward <gward@python.net> COPYRIGHT
Copyright (c) 1997-2000 by Gregory P. Ward. All rights reserved. This file is part of the Text::BibTeX library. This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2012-06-02 Text::BibTeX::BibSort(3pm)
All times are GMT -4. The time now is 07:34 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy