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 ----------
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)
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.
gp1 : xyz xys3 syt2 ssx itt kty
gp2 : syt2 kgk iti op2
gp3 : ppy yt5 itt sky... (11 Replies)
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)
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
It works ok, all times $file is not equal to 1500 I have the error message.
I try to do something similar... (7 Replies)
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.
I have to search for F (F followed by numbers) and ... (5 Replies)
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)
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)
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).
.Some other data
.Some... (17 Replies)