This file is just a miniature version of what I really have. Original file is some 1 million lines long.
I have tried to come up with the code for what I wish to accomplish but to no avail.
The task: What I want to do is the read this file (filename: log.txt) and add all those numbers which correspond to the same word and hence shrink the file to an output file say output_log.txt. I mean this is what I want:
What I have done is that added all the numbers which appear against the same word that is why I have put 15 against abc that is (1+2+3+4+5=15)
I know how to add the numbers of a coloumn using this
But I am not able to figure out as to how to shrink the file and put the numbers against them. I am using Linux with BASH.
---------- Post updated at 12:22 PM ---------- Previous update was at 12:14 PM ----------
Great..
I could figure it out after reading some of the posts in this forum:
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,
I am stuck with a problem, will be thankful for your guidance and help.
I have two files. Each line is a group of words with first word as group Id. eg. 'gp1' in File1 and 'grp1' in File2.
<File1>
gp1 : xyz xys3 syt2 ssx itt kty
gp2 : syt2 kgk iti op2
gp3 : ppy yt5 itt sky... (11 Replies)
Hi All,
I tried to solve this but the result gives me all zeros for one file. I failed to do for all 500 files.
I have some 500 files with the extension .dat I have another set of files; 500 in number with extension .dic I created these .dic files by using sort -u from the actual .dat files.... (2 Replies)
Hi. I have a file containing words and numbers associated with them as follows -
c 2
b 5
c 5
b 6
a 10
b 16
c 18
a 19
b 21
c 27
a 28
b 33
a 76
a 115
c 199
c 251
a 567
a 1909 (4 Replies)
Hi,
Sorry in advance for propably a silly question, but I am a bit lost.
On some of the linux job flow I have the following check:
if ($file != 1500) then
echo ERROR
It works ok, all times $file is not equal to 1500 I have the error message.
I try to do something similar... (7 Replies)
Hi All,
I have searched the forum and tried to print only matching(pattern) words from the file, but its printing entire line. I tried with grep -w. I am on sunsolaris.
Eg:
cat file
A|A|F1|F2|A|F3|A
A|F10|F11|F14|A|
F20|A|F21|A|F25
I have to search for F (F followed by numbers) and ... (5 Replies)
Greetings.
I am a UNIX newbies.
I am currently facing difficulties dealing with a large data set and I would like to ask for helps. I have a input file like this:
ak 1 AAM1
ak 2 AAM1
ak 3 AAM1
ak 11 AMM2
ak 12 AMM2
ak 13 AMM2
ak 14 AMM2
Is there any possibility for me to... (7 Replies)
Hi,
I have an array in which one column can contain any statement.
From multiple rows of that column I want to match the statement like "Execution Started."
If that row contains "Execution started." then only I have to fetch other data of other columns of that particular row.
I dont want... (2 Replies)
Hi all,
Please some help over here. I have a Sales.txt file containing info in blocks for
every sold product in the pattern showed below (only for 2 products).
NEW BLOCK
SALE DATA
PRODUCT SERIAL
79833269999 146701011945004
.Some other data
.Some... (17 Replies)
Hi,
If i give a number say "1234" the output of mysql query should be:
one thousand and twenty four
How to write mysql query for this?
With regards
Vanitha (5 Replies)