Search Results

Search: Posts Made By: theflamingmoe
3,178
Posted By theflamingmoe
Overwhelmed by the response to my question. I...
Overwhelmed by the response to my question. I was worried i wouldn't get any replys. Thanks drtx1.
3,178
Posted By theflamingmoe
Thanks again Durden_Tyler, your post was very...
Thanks again Durden_Tyler, your post was very helpfull.
Regards,
Theflamingmoe
3,178
Posted By theflamingmoe
Thanks Durden_Tyler. I am extracting the table...
Thanks Durden_Tyler. I am extracting the table from a database and do have access to SQL Server. I never tried using SQL Server but from what you tell me it will make my life easier and maybe i...
3,178
Posted By theflamingmoe
Wow, thanks so much RudiC. I'm still going over...
Wow, thanks so much RudiC. I'm still going over your reply trying to digest parts of your code. Much appreciated.
3,178
Posted By theflamingmoe
awk Moving Average
Hi, I'm using awk to try and get a moving average for the second column of numbers ($2) in the below example broken out by unique identifier in column 1 ($1) :


H1,1.2
H1,2.3
H1,5.5
H1,6.6...
5,661
Posted By theflamingmoe
Thanks for your help Don and sorry for not...
Thanks for your help Don and sorry for not answering all your questions. The code works perfectly and matches my requirements. Regarding the "group ru are -9" in your post, it was a typo error. I...
5,661
Posted By theflamingmoe
Fair enough Don My various attempts were...
Fair enough Don

My various attempts were something along the line of adding a for (group in a) as part of the code. For example:

gawk -F"," 'NR>1 {for...
5,661
Posted By theflamingmoe
Thanks jlliagre, that worked perfectly. I have...
Thanks jlliagre, that worked perfectly. I have one final question. Say I have the same data, but added two groups, rd and ru. How would I get the average of the groups?

cu,u3o8,au,ag,group...
5,661
Posted By theflamingmoe
Average across multiple columns - awk
Hi forum members,

I'm trying to get an average of multiple columns in a csv file using awk. A small example of my input data is as follows:

cu,u3o8,au,ag
-9,20,-9,3.6
0.005,30,-9,-9...
7,296
Posted By theflamingmoe
Thanks for the reply's and extra examples, much...
Thanks for the reply's and extra examples, much appreciated :)
7,296
Posted By theflamingmoe
Transpose column to row - awk
Hi there,

I have a small csv file example below:

source,cu_001,cu_001_volume,cu_001_mass,cu_002,cu_002_volume,cu_002_mass,cu_003,cu_003_volume,cu_003_mass...
1,253
Posted By theflamingmoe
Thanks Corona688, you answered my question...
Thanks Corona688, you answered my question perfectly. The comma in the statement "OFS,$i" was in the original script, but it's probably a typo. I'll check it out. Thanks again ;)

TheFlamingMoe...
1,253
Posted By theflamingmoe
Explanation of print statement - awk
Hi, i'm just after a simple explanation of how the following awk oneliner works.

gawk -F"," '{for(i=m;i<=n;i++)printf "%s" OFS,$i; print x}' m=1 n=70 OFS=, input.csv > output.csv

In particular...
8,734
Posted By theflamingmoe
Thanks very much for the replys :). I originally...
Thanks very much for the replys :). I originally mucked around with a few pieces of code such as:

sed 's/\(\.[1-9][1-9]\)0/\1/' inputfile

and

awk '{gsub(/\.000/,"",$1); print $1}'...
8,734
Posted By theflamingmoe
Remove trailing zeros
Hi I have a simple request but can't find the answer. I want to remove trailing zeros, and in some cases the fullstops, from the input data. Example of input file:


FR002_15.000_20.000...
1,157
Posted By theflamingmoe
One last try, Lets say I have two comma...
One last try,

Lets say I have two comma separated lists of fruit:

fruit1.txt
apples,red,2,32,8
pears,green,4,8,20
grapes,black,150,200,160
bannas, yellow,20,15,12
mangos,yellow,30,40,60...
1,157
Posted By theflamingmoe
Thanks for your time Corona688. I guess my...
Thanks for your time Corona688. I guess my explanation and example was about as clear as mud. Partly because i'm not too sure how the arrays work. Is it possible to index multiple values, in this...
1,157
Posted By theflamingmoe
Ok, I can't seem to get the tags to work so...
Ok,
I can't seem to get the tags to work so I've appended two files.

Desired output based on array $1,$2,$3,$5 would be:

RD158,SR25509,501,1.3

Desired output based on array $1,$2,$3,$6...
1,157
Posted By theflamingmoe
awk_Compare two files with a loop
Hi,
I have a small query when comparing two files with awk. I have a small piece of code running in a shell. See below:

gawk -F"," 'NR == FNR { A[$1","$2","$3","$4]=1; next }...
4,795
Posted By theflamingmoe
Thanks Chubler_XL, that worked like a charm ;)
Thanks Chubler_XL, that worked like a charm ;)
4,795
Posted By theflamingmoe
unique random numbers awk
Hi, I have a small piece of awk code (see below) that generates random numbers.

gawk -F"," 'BEGIN { srand(); for (i = 1; i <= 30; i++) printf("%s AM329_%04d\n",$0,int(36 * rand())+1) }' OFS=,...
1,021
Posted By theflamingmoe
Increment Gawk
Hi,
I have a small query with gawk which i'm unsure how to solve. My csv input data is as follows:


1 58352.9 34549 -469.323 LINE_149
2 58352.9 34499 -469.323 LINE_149
3 58352.9 34549...
2,710
Posted By theflamingmoe
Are you referring to the "Relative Difference"?? ...
Are you referring to the "Relative Difference"??

Calculation for relative difference is ((400/3)-1)*100
8,179
Posted By theflamingmoe
Thanks guys, the suggestion by Scrutinizer works...
Thanks guys, the suggestion by Scrutinizer works :o) Thanks also to rangarasan, I didn't know about the asort function and i'll check it out :o)
8,179
Posted By theflamingmoe
sort: cannot create tempory file
Hi, I'm having a bit of trouble running a line of code below:


gawk -F"," '/F/{print $6}' OFS="," large_csv_file.csv | sort | uniq -c >> 01_SUMMARY_UNIQUECHECK.csv


The code runs fine on...
Showing results 1 to 25 of 35

 

Featured Tech Videos

All times are GMT -4. The time now is 08:29 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy