I'm stumped on the point of sorting the file at the end. The first line you write to identify the file will be very unlikely to stay with the content, and the content itself may not stay in order either.
What are you trying to achieve? There is probably a far neater way to achieve it as Don alludes to, but we would need to know what inputs/files you have and what is the required output.
For instance:-
Quote:
I have three directories (for testing) dir-a, dirb and dir-c
They all contain separate files file-a, file-b & file-c respectively
Each file contains my data.
The output I want is:-
You would be best to tell us which bits need to be sorted (reverse) and which bits need to remain as they are.
I'm sure we can help if we fully understand the problem.
I a file with log entries... I want to sort it so that the last line in the file is first and the first line is last..
eg.
Sample file
1
h
a
f
8
6
After sort should look like
6
8
f
a
h
1 (11 Replies)
I need to sort the particular column only in reverse order how i can give it..
if i give the -r option the whole file is getting sorted in reverse order.
1st 2nd col 3rd
C col 4th col 5th col
-------------------------------------------
C... (7 Replies)
Hi Everyone,
I have one a.txt:
a b 001 c
b b 002 c
c c, not 002 c
The output should be
001
002
002
If i use cut -f 3 -d' ', this does not work on the 3rd line, so i thought is any way to cut the field counting from the end? or any perl thing can do this?:confused:
... (3 Replies)
command/script(apart from awk) to print the fields in reverse order
that is last field has to come first and so on and first field has to go last
Input
store-id date sale
.............
.............
... (3 Replies)
Hi,
I want to print the item in reverse order such that the output would look like
00 50 50 23 40 22 02 96
Below is the input:
00 05 05 32 04 22 20 69
Video tutorial on how to use code tags in The UNIX and Linux Forums. (5 Replies)
Hello,
I have a large database of words and would like them sorted in reverse order i.e. from the end up.
An example will make this clear:
I have tried to write a program in Perl which basically takes the string from the end and tries to sort from that end but it does not seem... (5 Replies)
Hi all,
i have dynamic file 'xyz.txt', records always look likes below format ...
0000021 RET 31-MAR-1984 FAP
0000021 DTA 14-JAN-2003 CNV
0000021 DTA 25-MAR-2012 DTA
0000021 DTA 26-MAR-2012 DTA
#################################################
0000021 DTA ... (4 Replies)
Discussion started by: krupasindhu18
4 Replies
LEARN ABOUT DEBIAN
ppi::statement::data
PPI::Statement::Data(3pm) User Contributed Perl Documentation PPI::Statement::Data(3pm)NAME
PPI::Statement::Data - The __DATA__ section of a file
SYNOPSIS
# Normal content
__DATA__
This: data
is: part
of: the
PPI::Statement::Data: object
INHERITANCE
PPI::Statement::Compound
isa PPI::Statement
isa PPI::Node
isa PPI::Element
DESCRIPTION
"PPI::Statement::Data" is a utility class designed to hold content in the __DATA__ section of a file. It provides a single statement to
hold all of the data.
METHODS
"PPI::Statement::Data" has no additional methods beyond the default ones provided by PPI::Statement, PPI::Node and PPI::Element.
However, it is expected to gain methods for accessing the data directly, (as a filehandle for example) just as you would access the data in
the Perl code itself.
TO DO
- Add the methods to read in the data
- Add some proper unit testing
SUPPORT
See the support section in the main module.
AUTHOR
Adam Kennedy <adamk@cpan.org>
COPYRIGHT
Copyright 2001 - 2011 Adam Kennedy.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
perl v5.10.1 2011-02-26 PPI::Statement::Data(3pm)