Hi everyone, I had a similar question a couple days ago but my problem has gotten significantly (to me anyway) more complex.
I have two files:
Values for column 1 might be in file 1 and not file 2, or in file 2 and not file 1.
I want awk to look at file 1 and save those column 1 values,
then match those values with the corresponding row in file 2 and then calculate the differences between these numbers. so, for example, line 1's desired
output would be.
A couple of caveats. If a value for column 1 is not in both files, I don't care about it. Also, the solution doesn't have to be awk, or fast or efficient. I just need something that works!
I'm trying to learn awk, but I've hit a roadblock with this problem. I have a hierarchy stored in a file with 3 columns:
id name parentID
4 D 2
2 B 1
3 C 1
1 A 5
I need to check if there are any values in column 3 that are not represented anywhere in column 1. I've tried this:
awk '{arr;}... (7 Replies)
Hi Experts,
Please bear with me, i need help
I am learning AWk and stuck up in one issue.
First point : I want to sum up column value for column 7, 9, 11,13 and column15 if rows in column 5 are duplicates.No action to be taken for rows where value in column 5 is unique.
Second point : For... (12 Replies)
Hi Folks,
I have a file with 2 columns TAB delimited and I want to add '1' to the first column and subtract '-1' from the second column.
What I have tried so far is;
awk -F"\t" '{ $1-=1;$2+=1}1' OFS='\t' file
File
0623 0623
0624 0624
0643 0643
1059 1037
1037 1037
1038 1038... (2 Replies)
Legends,
Please help me in , how do i subtract the variable values listed like below.
the first value of orig should be subtracted from first value of prev and so on.
san> echo $orig
346 316 340 239 410 107 291 139 128 230 167 147 159 159 172 116 110 260 177 0 177 169 168 186 165 366 195... (15 Replies)
Hello,
I am obviously quite new to unix and awk. I need to parse certain columns of a file (delimited by spaces), and somehow save the value of this column somewhere, together with the value of the column just after it (by pairs; so something like ).
I'm then supposed to count the times that... (9 Replies)
Hi All,
I have a file of 100 lines of each having 1000 columns. I need to find the difference of each column against each other. That means, Col1-Col1; Col1-Col2; Col1-Col3;......Col1-Col1000; Col2-Col1; Col2-Col2; Col2-Col3;.... and so on ....up to Col1000-Col1000.
Lets say the file is... (6 Replies)
# foreach sub ( sub001 )
sub=sub001
cd /mnt/stor/smith/recog/$sub/event_files/timecorrected/
awk '{$1-1.5}' $sub_CR
end
What im trying to do is:
1. open a 1D file that consists of lists of integers in rows a columns
2. subtract 1.5 from each integer in the first column
3. save the file... (1 Reply)
i have a small awk script which prints the 5 columns of different o/p i want the 5th column subtracted from 100 and then display the result .. but i do not get the desired result .. I 'm using following script
awk '
BEGIN {
FS=""
RS="us"
}
{
... (3 Replies)