11-04-2009
Get the bottom line of a file to the top of the file
Hi,
i have a small requirement where i have to get the bottom most line from a file to the topmost position. a small example is shown below..
$ cat beep.txt
It is first documented as being played in southern England.
In the 16th century.
By the end of the 18th century,
Cricket is a bat-and-ball team sport.
i want it as
$ cat beep.txt
Cricket is a bat-and-ball team sport.
It is first documented as being played in southern England.
In the 16th century.
By the end of the 18th century,
the problem is this file gets updated daily so each time i run the script i want to get the bottom most thing in the top most position....
Thanks for the help in advance
9 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi,
I have a file, which is having a pattern "SEARCH" somewhere towards end of the file,
if i am giving " grep -i "SEARCH" $File" , it is taking too much time as file is very big.
So i want to search for the pattern from the back side of the file, how can we search for a pattern in bottom... (5 Replies)
Discussion started by: Prat007
5 Replies
2. AIX
Hi
All,
I have AIX 5.3 server. I have one big file. in that i want to remove 5000 line from top. is there any command for this?
Thanks,
Vishal (6 Replies)
Discussion started by: vishalpatel03
6 Replies
3. Shell Programming and Scripting
say I want to insert "this is a test" as the first line into file A, besides
echo "this is a test" > /tmp/tmpfile
cat /tmp/tmpfile fileA >> /tmp/result,
is there any simple way I can do it? thanks (7 Replies)
Discussion started by: fedora
7 Replies
4. UNIX for Dummies Questions & Answers
infile
a b c
A E F
1 2 3 outfile
new line
a b c
A E F
1 2 3 I tried:
sed '1i\
new line' infile > outfilecat outfile
new linea b c
A E F
1 2 3 I don't want the new line be added to the existing first line.
Thanks
Joseph (7 Replies)
Discussion started by: jdhahbi
7 Replies
5. Shell Programming and Scripting
Hi Folks
I need a one liner to parse through a log and if the string is found print the line above, the line with the string and the line below.
example:
The ball is green and blue
Billy through the ball higer.
Jane got hurt with the ball.
So if I search for Billy I would need the 3... (1 Reply)
Discussion started by: bombcan
1 Replies
6. Ubuntu
Hello forum,
Seems that only I have alot of questions regarding Ubuntu :D
In Ubuntu 12.04 LTS the gnome I have been using gdm and lightdm.
In lightdm the top and side bars are aka "unity" and can be removed using apt-get remove unity
I need to do the same for menu bars gdm. I do not... (0 Replies)
Discussion started by: br1an
0 Replies
7. Shell Programming and Scripting
Hi,
i have a file which contains PID and wanted to execute kill command. but the thing is, when killing PID's needs to kill PID from bottom to top.
Please help
INPUT
21414 sh -c extract.ksh ASA
21416 /bin/ksh extract.ksh ASA
21428 /usr/bin/perl -w /var/tmp/tempperl.21416 ASA... (4 Replies)
Discussion started by: reignangel2003
4 Replies
8. Shell Programming and Scripting
Dear All
I was wondering if someone could help me in resolving an issue.
I have a file like this:
column1 column2
2 4
3 5
8 9
0 12
0 0
0 0
9 0
87 0
1 0
1 0
1 0
4 0 (2 Replies)
Discussion started by: giuliangiuseppe
2 Replies
9. Shell Programming and Scripting
Hi,
I have a requirement where I need to delete given number of top and bottom rows in a flat file which has new line as its delimiter.
For ex: if top_rows=2 & bottom_rows=1
Then in a given file which looks like:
New York
DC
LA
London
Tokyo
Prague
Paris
Bombay
Sydney... (7 Replies)
Discussion started by: calredd
7 Replies
LEARN ABOUT DEBIAN
datetime::format::epoch::jd
DateTime::Format::Epoch::JD(3pm) User Contributed Perl Documentation DateTime::Format::Epoch::JD(3pm)
NAME
DateTime::Format::Epoch::JD - Convert DateTimes to/from Julian Days
SYNOPSIS
use DateTime::Format::Epoch::JD;
my $dt = DateTime::Format::Epoch::JD->parse_datetime( 2453244.5 );
# 2004-08-27T00:00:00
DateTime::Format::Epoch::JD->format_datetime($dt);
# 2453244.5
my $formatter = DateTime::Format::Epoch::JD->new();
my $dt2 = $formatter->parse_datetime( 2453244.5 );
# 2004-08-27T00:00:00
$formatter->format_datetime($dt2);
# 2453244.5
DESCRIPTION
This module can convert a DateTime object (or any object that can be converted to a DateTime object) to the Julian Day number. This is the
number of days since noon U.T.C. on January 1, 4713 B.C. (Julian calendar).
This time scale was originally proposed by John Herschel, and is often used in astronomical calculations.
Similar modules are:
o DateTime::Format::Epoch::MJD
Implements the "modified Julian Day", starting at midnight U.T.C., November 17, 1858. This number is always 2,400,000.5 lower than the
JD, and this count only uses five digits to specify a date between 1859 and about 2130.
o DateTime::Format::Epoch::RJD
Implements the "reduced Julian Day", starting at noon U.T.C., November 16, 1858. This number is always 2,400,000 lower than the JD.
o DateTime::Format::Epoch::TJD
Implements the "truncated Julian Day", starting at midnight U.T.C., May 24, 1968. This number is always 2,440,000,5 lower than the JD.
Actually, there is another version of the TJD, defined as JD modulo 10,000. But that one is a bit harder to implement, so you'll have
to do with this version of TJD. Or don't use TJD's at all.
o DateTime::Format::Epoch::RataDie
Implements the Rata Die count, starting at January 1, 1 (Gregorian). This count is used by DateTime::Calendar programmers.
o DateTime::Format::Epoch::Lilian
Implements the Lilian count, named after Aloysius Lilian (a 16th century physician) and first used by IBM (a 19th century punched card
machine manufacturer). This counts the number of days since the adoption of the Gregorian calendar. Only days are counted, and
October 15, 1584 is day 1.
METHODS
Most of the methods are the same as those in DateTime::Format::Epoch. The only difference is the constructor.
o new()
Constructor of the formatter/parser object. It has no parameters.
SUPPORT
Support for this module is provided via the datetime@perl.org email list. See http://lists.perl.org/ for more details.
AUTHOR
Eugene van der Pijll <pijll@gmx.net>
COPYRIGHT
Copyright (c) 2004 Eugene van der Pijll. All rights reserved. This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
SEE ALSO
DateTime
datetime@perl.org mailing list
perl v5.10.1 2007-12-03 DateTime::Format::Epoch::JD(3pm)