Search Results

Search: Posts Made By: Ads89
Forum: Linux 04-20-2018
3,286
Posted By Ads89
Finding files older than x days within directory with spaces
Hi,

I am trying to run a command that finds all files over x amount of days, issue is one of the directories has spaces within it.

find /files/target directory/*/* -type f -mtime +60 When...
16,460
Posted By Ads89
Hi Rudi - The problem is that the word I am...
Hi Rudi - The problem is that the word I am grepping for, doesnt exist in the file - It is returning 0 when it should actually return 1. From command line it works as expected, but when put into the...
16,460
Posted By Ads89
Still having the same issue even with double...
Still having the same issue even with double quotes - Here is a copy from the log

+ TRIM_FILENAME=TEST1-AAA_test.csv
+ grep -E '^TEST1-AAA_test.csv' Valid_List.csv
+ '[' 0 = 0 ']'
+ echo -e...
16,460
Posted By Ads89
Grep for an exact match in a file
I am currently having some issues while trying to grep for a exact string inside a file. I have tried doing this from command line and things work fine i.e. when no match is found, return code=1 but...
1,604
Posted By Ads89
Extract columns into seperate file
I have a comma delimited file as per the one below and I am currently extracting the values in 2 columns (COL1 & COL6) to produce a smaller trimmed down version of the file which only contains the...
1,611
Posted By Ads89
Sort unique
Hi,

I have an input file that I have sorted in a previous stage by $1 and $4. I now need something that will take the first record from each group of data based on the key being $1


Input file...
7,993
Posted By Ads89
Awesome! Works perfectly - thank you!!
Awesome! Works perfectly - thank you!!
7,993
Posted By Ads89
awk - Merge two files based on one key
Hi,

I am struggling with the an awk command to merge two files based on a common key.

I want to append the value from File2 ($2) onto the end of File1 where $1 from each file matches - If no...
2,062
Posted By Ads89
Don, Thank you so much for the above -...
Don,

Thank you so much for the above - working perfectly for what I need.

Thanks for helping with this one, it's been a life saver!
2,062
Posted By Ads89
Hi Don, Yes you're right, the key is COL2,...
Hi Don,

Yes you're right, the key is COL2, COL3 and COL4 - Am I right in thinking that this is the bit that needs to be changed to reflect that?

$2$3$4 != last {
# $2 has changed, add any...
2,062
Posted By Ads89
Hi Don, Thanks a lot for the above - I have...
Hi Don,

Thanks a lot for the above - I have tested that and it works really nicely for what I need - there is just one scenario which I don't think I explained too well before;

There could be a...
2,062
Posted By Ads89
Hi Rudi, Thank you so much for the above,...
Hi Rudi,

Thank you so much for the above, that's brilliant!

There is a couple of things I dont think I was clear on to begin with so apologies for that.

In the above output that you have...
2,062
Posted By Ads89
awk - printing new lines based of 2 dates
I have some test data that is seperated out into annual records, each record has a start date (COL7), an end date (COL8) and a maturity date (COL18) - What I need to do is ensure that there is one...
2,185
Posted By Ads89
awk - Print Sum
Hi,

I have an awk command that I am using, and part of it sums COL_9 however when I read the output it is not including decimal places;

awk '
BEGIN{FS=OFS=","}
NR==1{print;next}...
2,324
Posted By Ads89
Apologies - new to awk and trying to get my head...
Apologies - new to awk and trying to get my head around the syntax. This solution works great, thanks again for your help.
1,160
Posted By Ads89
Works perfect - thank you for your help!
Works perfect - thank you for your help!
2,324
Posted By Ads89
Rudi, I have the below code; awk...
Rudi,

I have the below code;

awk 'BEGIN{FS=OFS=","}
NR==1{print;next}
{a[$4";"$7";"$8";"$13]+=$9}
END{for(i in a) print $1, $2, $3, split(i,b,";") b[1]}' BUCKETED.csv > COL_TOTAL.csv
...
2,324
Posted By Ads89
Hi Rudi, I am not aware of the Split...
Hi Rudi,

I am not aware of the Split function - Can you provide an example please?
1,160
Posted By Ads89
awk - Pick last value from set of rows
Input data


COL_1,COL_2,COL_3,COL_4,COL_5,COL_6,COL_7,COL_8,COL_9,COL_10,COL_11,COL_12,COL_13
C,ABC,ABCD,3,ZZ,WLOA,2015-12-01,2016-12-01,975.73,ZZZ,P,111111.00,Y1 **GROUP1**...
2,324
Posted By Ads89
awk substr delimeter
Hi All,

I have an awk command that uses the substr function - At the moment I know the length of the values so can use the example below i.e substr(i,0,1)

However in future these lengths may...
1,038
Posted By Ads89
Hi Don, Thanks for the above, that...
Hi Don,

Thanks for the above, that solution works well for generating the different years I require, but I also need a way to group these records as mentioned above.

We need to group...
1,038
Posted By Ads89
Yearly Grouping of Data
I need some logic that would help to group up some records that fall between two dates:

Input Data

COL_1 COL_2 COL_3 COL_4 COL_5 COL_6 COL_7 COL_8 COL_9 COL_10 COL_11 COL_12
C ...
2,323
Posted By Ads89
RudiC, That solution works perfect - I also...
RudiC,

That solution works perfect - I also have a file that need to same sort of treatment

NAME,1,15-Dec-15,"13,420.58",P,"110,264.04",USD
NAME,1,21-Dec-15,862.2760926,I,"110,264.04",USD...
2,323
Posted By Ads89
That is great thank you! In your example...
That is great thank you!

In your example when I run, It returned ID values up to #10 - If I wanted to change that to go up to 1000 which bit within that code would need to change?
2,323
Posted By Ads89
awk print columns and variable
Hi,

Can anyone help with the below please?

I have written some code which takes an input file, and and prints the contents out to a new file - it then loops round and prints the same columns,...
Showing results 1 to 25 of 25

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