Sponsored Content
Top Forums Shell Programming and Scripting Execution problem with sort the file based on contents Post 302359989 by patrick87 on Thursday 8th of October 2009 12:15:15 AM
Old 10-08-2009
Execution problem with sort the file based on contents

My input file:
>ali
ASSDDGHFHFHJFJHJDSDGSDGSDGSDGSDGSDGSDGDSGDSGSDGDSGSDGSDGDSGSDGGDSG
>zzz
ASdASDASDSADSADDSADJKHJDSADKLJADKLSAJDLJLKJLDASDDSADd
>abu
ASDASDFSAFASFSADFASDASDSADSADSADSADSADSADASDASdSADSADSADA
>aaa
MMMMASDSADSAMDASDSADSADSADSADSADDDDDDDDDDDDDDASDOIIEOUWIOEUQWIOEWQOEUWQIOEUWQIEOWQE

My desired output:
>aaa
MMMMASDSADSAMDASDSADSADSADSADSADDDDDDDDDDDDDDASDOIIEOUWIOEUQWIOEWQOEUWQIOEUWQIEOWQE
>ali
ASSDDGHFHFHJFJHJDSDGSDGSDGSDGSDGSDGSDGDSGDSGSDGDSGSDGSDGDSGSDGGDSG
>abu
ASDASDFSAFASFSADFASDASDSADSADSADSADSADSADASDASdSADSADSADA
>zzz
ASdASDASDSADSADDSADJKHJDSADKLJADKLSAJDLJLKJLDASDDSADd

How can I do to sort (descending order or ascending order) the file based on the contents inside each header?
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

file extension based software execution

Hi Experts, I am working in HP-UX 11.0 workstaion. How can i make a file to be executed with the corresponding software to be invoked or executed. as in Windows. ie., if a file index.html has to be double clicked to invoke the Netscape Navigator. What i have to do to achieve this... (2 Replies)
Discussion started by: anent
2 Replies

2. Shell Programming and Scripting

sh script that reads/writes based upon contents of a file

Hi everyone, Ive got a quick question about the feasibility and any suggestions for a shell script. I can use sh or ksh, doesnt matter. Basically, Ive got an output file from a db2 command that looks like so: SCHEMA NAME CARD LEAF ELEAF LVLS ISIZE NDEL KEYS F4 F5 ... (3 Replies)
Discussion started by: rdudejr
3 Replies

3. Shell Programming and Scripting

Remove lines based on contents of another file

So, this issue is driving me nuts! I was hoping to get a lending hand here... I have 2 files: file1.txt contains: this is example1 this is example2 this is example3 this is example4 this is example5 file2.txt contains: example3 example5 Basically, I need a script or command to... (4 Replies)
Discussion started by: bashshadow1979
4 Replies

4. Shell Programming and Scripting

move contents from one file to another based on line number or content

I want a script that will move everything beyond a certain line number or beyond a certain content word into another file. For example, if file A has this: first line second line third line forth line fifth line sixth line I want to run a script that will move everything beyond the third... (4 Replies)
Discussion started by: robp2175
4 Replies

5. UNIX for Dummies Questions & Answers

count values based on contents of another file

Hello, I have two files as shown below: test1 678 679 689 690 710 test2 1 678 654 800 676 791 689 900 I want to get a count of lines from test2 whose columns bound the values in test1 I tried running the code below; however am getting wrong results. (3 Replies)
Discussion started by: Gussifinknottle
3 Replies

6. Shell Programming and Scripting

Help with sort data based on descending order problem

Input file 9.99331e-13 8.98451e-65 9.98418e-34 7.98319e-08 365592 111669 74942.9 0 Desired output 365592 111669 74942.9 7.98319e-08 1.99331e-13 6.98418e-34 (2 Replies)
Discussion started by: perl_beginner
2 Replies

7. UNIX for Dummies Questions & Answers

find lines in another file based on contents in a second file

Hello, I have a file with tab delimited columns like: File1 A 2 C R F 4 D Q C 9 A B ...... I want to grep out the lines in a second file, File2, corresponding to each line in File1 Can I do this: while read a b c d do grep '$a\t$b\t$c\t$d' File2 >>... (2 Replies)
Discussion started by: Gussifinknottle
2 Replies

8. Shell Programming and Scripting

File comparison based on contents

Hi I have 2 files 1.del ---- 1,2,3,4,5 1,2,3,4,4 1,1,1,1,2 2.del ---- 1,2,3,4,5 1, 1,2,3,4,4 1,1,1,1,2 I need to compare the above two files in unix, as in the output should only tell the difference in contents as I should get only the line 1 ( from 2.del) , rest all lines are... (4 Replies)
Discussion started by: Ethen561
4 Replies

9. Shell Programming and Scripting

Remove or rename based on contents of file

I am trying to use the two files shown below to either remove or rename contents in one of those files. If in file1.txt $5 matches $5 of file2.txt and the value in $1 of file1.txt is not "No Match" then that value is substituted for all values in $5 and $1 of file2.txt. If however in $1 ... (5 Replies)
Discussion started by: cmccabe
5 Replies

10. Shell Programming and Scripting

awk to change contents of field based on condition in same file

In the awk below I am trying to copy the entire contents of $6 there may be multiple values seperated by a ;, to $8, if $8 is . (lines 1 and 3 are examples). If that condition $8 is not . (line2 is an example) then that line is skipped and printed as is. The awk does execute but prints the output... (3 Replies)
Discussion started by: cmccabe
3 Replies
ALI(1)                                                               [nmh-1.5]                                                              ALI(1)

NAME
ali - list mail aliases SYNOPSIS
ali [-alias aliasfile] [-list | -nolist] [-normalize | -nonormalize] [-user | -nouser] [-version] [-help] [aliases ...] DESCRIPTION
Ali searches the named mail alias files for each of the given aliases. It creates a list of addresses for those aliases, and writes that list on standard output. If no arguments are given, ali outputs all alias entries. By default, when an aliases expands to multiple addresses, the addresses are separated by commas and printed on as few lines as possible. If the -list option is specified, then when an address expands to multiple addresses, each address will appear on a separate line. The switch -user directs ali to perform its processing in an inverted fashion: instead of listing the addresses that each given alias expands to, ali will list the aliases that expand to each given address. If the -normalize switch is given, ali will try to track down the official hostname of the address. The files specified by the profile entry "Aliasfile" and any additional alias files given by the -alias aliasfile switch will be read. Each alias is processed as described in mh-alias(5). FILES
$HOME/.mh_profile The user profile /etc/passwd List of users /etc/group List of groups PROFILE COMPONENTS
Path: To determine the user's nmh directory Aliasfile: For a default alias file SEE ALSO
mh-alias(5) DEFAULTS
`aliasfiles' defaults to /etc/nmh/MailAliases `-nolist' `-nonormalize' `-nouser' CONTEXT
None BUGS
The -user option with -nonormalize is not entirely accurate, as it does not replace local nicknames for hosts with their official site names. MH.6.8 11 June 2012 ALI(1)
All times are GMT -4. The time now is 09:23 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy