The original tac reverses tokens separated by spaces. The last token on each line is "number-followed-by-newline". When the tokens are reversed, the last token is "24-newline", and so on.
The solutions posted are fine. Here is a compact perl solution:
producing:
The heart of the operation: after the lines are reversed by tac, process them with a perl script. The easy-to-read-but-not-so-easy-to-understand perl code stacks a number of functions: split the line into an array of tokens, reverse the content of the array (and thus the tokens), join the array with a space as separator into a string, print the string with a newline at the end. The "-n" says to do that series of operations for each line ... cheers, drl
Hi guys, my supervisor has asked me to solve the problem in 7 days, I've taken 3 days to think about it but couldn't figure out any idea.
Please give me some thoughts with the following problem,
I have index.database that has only index date:
1994
1995
1996
1997
1998
1999
I have... (6 Replies)
Dear Unix Gurus,
I have a dataset consisting of a number of uneven columns. What I would like to do is fill up the missing rows with an arbitrary text of fixed value so that all columns now have an equal number of rows.
for example, in the sample datafile below...
1.0 1.3 0.25 2.2
2.0... (2 Replies)
Hi,
I have two files:
first input file is having 7-8 columns,
and second data file is like
I want to arrange my datafile1 in the order given in second data file, by comparing the seconddatafile with the second column of first file and print the entire line....also if any... (2 Replies)
Hi Friends,
I have come across some files where some of the columns don not have data.
Key, Data1,Data2,Data3,Data4,Data5
A,5,6,,10,,
A,3,4,,3,,
B,1,,4,5,,
B,2,,3,4,,
If we see the above data on Data5 column do not have any row got filled. So remove only that column(Here Data5) and... (4 Replies)
Hi,
I want to be able to read numbers from many files which have the same general form as follows:
C3H8 4.032258004031807E-002
Phi = 1.000000E+00 Tau = 5.749E+00
sL0 = 3.805542E+01 dL0 = 1.514926E-02
Tb = 2.328291E+03 Tu = 3.450E+02 Alpha = ... (3 Replies)
Hi all, I know this sounds suspiciously like a homework course; but, it is not.
My goal is to take a file, and match my "ID" column to the "Date" column, if those conditions are true, add the total number of minutes worked and place it in this file, while not printing the original rows that I... (6 Replies)
Hi again. Sorry for all the questions — I've tried to do all this myself but I'm just not good enough yet, and the help I've received so far from bartus11 has been absolutely invaluable. Hopefully this will be the last bit of file manipulation I need to do.
I have a file which is formatted as... (4 Replies)
Hi all, I'm pretty much a newbie to UNIX. I would appreciate any help with UNIX coding on comparing two large csv files (greater than 10 GB in size), and output a file with matching columns.
I want to compare file1 and file2 by 'id' and 'chain' columns, then extract exact matching rows'... (5 Replies)
data file contains
failed=24
error=23
error=163
failed=36
error=903
i need to get a total count of each value above. i'm looking for the most efficient method to do this as the datafile i provided is just a sample. the actual data can be several hundred thousands of lines.
so from... (3 Replies)