Sponsored Content
Top Forums Shell Programming and Scripting How to read records in a file and sort it? Post 302744027 by harish468 on Thursday 13th of December 2012 04:25:13 PM
Old 12-13-2012
Hey Thanks for the reply

I dont want to generate another file (or) change the input file.
I need to read the records which are sorted to store in variables.
Code:
i=0
while IFS="|" read -r usrId dataOwn expire email group secProf startDt endDt smhRole RoleCat DataProf SysRole MesgRole SearchProf 
do

print $usrId $dataOwn $expire $email $group $secProf $startDt $endDt $smhRole $RoleCat $DataProf $SysRole $MesgRole $SearchProf

done

when I print I need to get the sorted records...so the rows should be sorted by $usrId

I will use the sorted records and do some functionality to generate few other files.

Last edited by Franklin52; 12-14-2012 at 03:31 AM.. Reason: Please use code tags for data and code samples
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to read a particular line in a file with 500000 records init

I am trying to open a file and check a record. The file has 543267 records and I want to check the record 514455. I am trying to open in vi and go to that line :514455 but i get the error not enough lines in buffer How should i overcome this? Please help. (6 Replies)
Discussion started by: mhssatya
6 Replies

2. Shell Programming and Scripting

Sort & Split records in a file

Hi, I am new to scripting. I need a script to sort and the records in a file and then split them into different files. For example, the file is: H1...................... H2...................... D2.................... D2.................... H1........................... (15 Replies)
Discussion started by: Sunitha_edi82
15 Replies

3. Shell Programming and Scripting

read records from a file

Hi all, I have a requirement where I need to read records one by one from a file. I have tried this below code: while read mLine do echo 'Line = '${mLine} done < input_file --- But the problem here is im getting the records with removed spaces. --Supposer if the record is like... (3 Replies)
Discussion started by: srilaxmi
3 Replies

4. Shell Programming and Scripting

need shell script to read particular records from a file

i am reading an i/p file input.txt as below and want to read all filenames as in highlighted in bold below and put them in a different file output.txt. can someone help me with a shell script to do this? thanks in advance regards brad input.txt --------- START TYPE:OPT INIT_SEQ:01... (8 Replies)
Discussion started by: bradc
8 Replies

5. Shell Programming and Scripting

sort a file which has 3.7 million records

hi, I'm trying to sort a file which has 3.7 million records an gettign the following error...any help is appreciated... sort: Write error while merging. Thanks (6 Replies)
Discussion started by: greenworld
6 Replies

6. Shell Programming and Scripting

How to read each 2 records from a file

Hi, I have 10000 records in my test.dat file All records are under the following format a,12,45,bn,c a,16,46,bn1,c a,18,47,bn2,c a,12,47,bn3,c a,11,49,bn4,c I have to read each 2 records and assign it into a temp file .Can anybody help me in this? Thanks (3 Replies)
Discussion started by: kavithakuttyk
3 Replies

7. UNIX for Dummies Questions & Answers

Alphabetical sort for multi line records contains in a single file

Hi all, I So, I've got a monster text document comprising a list of various company names and associated info just in a long list one after another. I need to sort them alphabetically by name... The text document looks like this: Company Name: the_first_company's_name_here Address:... (2 Replies)
Discussion started by: quee1763
2 Replies

8. Shell Programming and Scripting

Read a file with n records as one big string using linux

Hello! Is there a way i can read a file with n records as one big string using linux shell script? I have a file in the below format - REC1 REC2 REC3 . . . REC4 Record length is 3000 bytes per record and with a newline char at the end. What i need to do is - read this file as one... (5 Replies)
Discussion started by: mailme0205
5 Replies

9. Shell Programming and Scripting

Read File and check records for length

I need a script that will run in unix to: 1) Read and input file with 1 column that contains for ex: 0123456789 1234567890 ...etc 2) Checks the first column if it is: a. Numeric from 0 - 9 b. if it is not less... (4 Replies)
Discussion started by: mrn6430
4 Replies

10. Shell Programming and Scripting

How to read a particular records from a file?

Hi All Can anybody let me know the code to read a particular record from a file For e.g. File Name: File.txt File content: Script_path=/abc/def/script/ File_path=/xyz/data/ Business Date=19990905 SERVER_NAME=Server DATABASE_NAME=Database Login=NewUser Password=NewPassword ... (3 Replies)
Discussion started by: Siddhartha9833
3 Replies
CPAN::Changes::Release(3)				User Contributed Perl Documentation				 CPAN::Changes::Release(3)

NAME
CPAN::Changes::Release - Information about a particular release SYNOPSIS
my $rel = CPAN::Changes::Release->new( version => '0.01', date => '2009-07-06', ); $rel->add_changes( { group => 'THINGS THAT MAY BREAK YOUR CODE' }, 'Return a Foo object instead of a Bar object in foobar()' ); DESCRIPTION
A changelog is made up of one or more releases. This object provides access to all of the key data that embodies a release including the version number, date of release, and all of the changelog information lines. Any number of changelog lines can be grouped together under a heading. METHODS
new( %args ) Creates a new release object, using %args as the default data. version( [ $version ] ) Gets/sets the version number for this release. date( [ $date ] ) Gets/sets the date for this release. changes( [ $group ] ) Gets the list of changes for this release as a hashref of group/changes pairs. If a group name is specified, an array ref of changes for that group is returned. Should that group not exist, undef is returned. add_changes( [ \%options ], @changes ) Appends a list of changes to the release. Specifying a "group" option appends them to that particular group. NB: the default group is represented by and empty string. # Append to default group $release->add_changes( 'Added foo() function' ); # Append to a particular group $release->add_changes( { group => 'Fixes' }, 'Fixed foo() function' ); set_changes( [ \%options ], @changes ) Replaces the existing list of changes with the supplied values. Specifying a "group" option will only replace change items in that group. clear_changes( ) Clears all changes from the release. groups( sort => &sorting_function ) Returns a list of current groups in this release. If sort is provided, groups are sorted according to the given function. If not, they are sorted alphabetically. add_group( @groups ) Creates an empty group under the names provided. delete_group( @groups ) Deletes the groups of changes specified. delete_empty_groups( ) Deletes all groups that don't contain any changes. serialize( group_sort => &sorting_function ) Returns the release data as a string, suitable for inclusion in a Changes file. If group_sort is provided, change groups are sorted according to the given function. If not, groups are sorted alphabetically. SEE ALSO
o CPAN::Changes::Spec o CPAN::Changes o Test::CPAN::Changes AUTHOR
Brian Cassidy <bricas@cpan.org> COPYRIGHT AND LICENSE
Copyright 2011-2013 by Brian Cassidy This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.16.3 2013-05-02 CPAN::Changes::Release(3)
All times are GMT -4. The time now is 02:04 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy