I have a text file consisting of 4 columns. What I am trying to do is see whether column 2 repeats multiple times, and collapse those repeats into one row. For example, here is a snippet of the file I am trying to analyze:
Here is what I am trying to do: For the conditions where "Sure_Thing" and "Gamble_Loss" repeat, I want to collapse it into a single line, adding up all of column 4 over the repeats. So after I gawk it, I want it to look something like this:
Hello all,
I have a large csv file where there are four types of rows I need to merge into one row per person, where there is a column for each possible code / type of row, even if that code/row isn't there for that person.
In the csv, a person may be listed from one to four times... (9 Replies)
Using grep I can easily use:
cvs log |grep -iB 10 -A 10 'date: 2013-10-30'
to display search results and 10 lines before and after. How can this be accompished using gawk? (4 Replies)
Hi,
I have an input file like
F : 0.1 : 0.002
P : 0.3 : 0.004
P : 0.5 : 0.008
P : 0.1 : 0.005
L : 0.05 : 0.02
P: 0.1 : 0.006
P : 0.01 : 0.08
F : 0.02 : 0.08
Expected output: (2 Replies)
Hi everyone,
I have two files (A and B) and want to combine them to one by always taking 10 rows from file A and subsequently 6 lines from file B. This process shall be repeated 40 times (file A = 400 lines; file B = 240 lines).
Does anybody have an idea how to do that using perl, awk or sed?... (6 Replies)
Hi Guys,
After windows died on my netbook I installed Lubuntu and discovered Gawk about a month ago. After using Excel for 10+ years I'm amazed how quick and easily Gawk can process data but I'm stuck with a little problem merging data from multiple lines.
I'm an SEO Consultant and provide... (9 Replies)
sir... am having a data file of customer master., containing some important fields as a set one line after another.,
what i want is to have one set of these fields(rows) one after another in line.........then the second set... and so on... till the last set completed.
... (0 Replies)
Hi All,
I have a file with only one column and i need to subtract the adjacent lines of the same column and print it in the same column.
For Example:
(Input)
Col1
5
10
12
6
9
12
5
.
.
.
.output should be like this: (12 Replies)
I am attempting to combine sections of log that should be one line but are spaced out over 10-30 lines due to how the software is outputting the info. (If I am making a newbie mistake I apologize)
Example of log I am working with:
2009-04-14 14:51:22 access data here
info.
Info.
Info.
……..... (4 Replies)
Hi every body,
i have this file example :
TD1
TD2
TD3
.
.
.TDn
<DIE_1>
xxxxxx
<\DIE_1>
<TD1>
information 1
inormation n
<\TD1>
<TDq>
information (0 Replies)
how do you print the lines before and after the line you are interested in? Example: Line to be printed: line 344
Output:
line 343
line 344
line 345
Thanks (1 Reply)