Thankyou Don Cragun , I'm sorry for my error.
The statment condition are :
if field 2 > 0 && field 3 > 0 && field 4 > 0 put line into a newfile.csv.
In fact in the example that I posted there are 2 lines that well done satisfaction condition.
Thanks again,
---------- Post updated at 03:07 AM ---------- Previous update was at 03:05 AM ----------
I forgot.... probably the sort command it's no necessary for result
Let's go back to your first post, where you specified a sample input file:
and a desired output file:
In awk, $2 > 0 is true for every input line you have except the header line.
In awk, $3 > 0 is true for every input line you have except the header line.
And, in awk, $4 > 0 is false for every input line you have including the header line.
So, your criteria for determining lines to be printed does not even come close to matching the output you say you want. (Note also that there is a huge difference between:
the string in field 2 treated as a string of decimal digits and converted to an integer is greater than zero, or the string in field 3 or 4 collates higher than the string "0" (as stated above as field x > 0), and
the number of occurrences the strings in fields 2, 3, and 4 seen so far in any line's field 2, 3 or 4 are all more than 2 (as implemented in your sample awk code as a[$2]++ > 1 && a[$3]++ > 1 && a[$4]++ > 1).
My best guess based on the output you say you want and some guess work based on the script you're using is that you want to print all but one line for each set of lines where the awk expression $2";"$3";"$4 expands to the same string. But, if that is the case, why isn't there supposed to a line in your output corresponding to the two lines shown in red in your sample input? If that is not what you're trying to do, please try again to clearly explain what criteria is used to determine if a line is to be printed!
Your desired output shows that you chose the 1st line containing 78;17/09/2013;OL, but you chose the 2nd line containing 14;12/09/2013;AperturaTK. (This would be true whether you sorted the input using the sort command you provided or just processed the input without sorting it.)
Does the following simple awk script do what you want?:
If you want to run this on a Solaris/SunOS system, use /usr/xpg4/bin/awk, /usr/xpg6/bin/awk, or nawk instead of awk.
With your sample input, the script above produces the output:
Hello People
I have the following file.csv:
date,string,float,number,boolean
20080303,abc,1.5,123,Y
20080304,abc,1.2,345,N
20080229,nvh,1.4,098,Y
20080319,ugy,1.9,586,N
20080315,gyh,2.4,345,Y
20080316,erf,3.1,932,N
I need to filter the date field where I have a data bigger than I... (1 Reply)
Hi everybody,
I need some help please
I have a csv file named masterFile1.csv
header1,header2,header3
value1,value2,value3
value4,value5,value6
I am trying to add new columns in the end of the csv to have a new csv file named masterFile2.csv like this :... (3 Replies)
Hi All,
i have a .Csv file in the below format
startTime, endTime, delta, gName, rName, rNumber, m2239max, m2239min, m2239avg, m100016509avg, m100019240max, metric3min, m100019240avg, propValues
11-Mar-2012 00:00:00, 11-Mar-2012 00:05:00, 300.0, vma3550a, a-1_CPU Index<1>, 200237463, 0.0,... (9 Replies)
Hi,
Using AWK script I want to pick those rows that has AT LEAST TWO columns EACH has a count >=3.
i.e. two conditions: at least two columns, each of which has a count at least 3.
There must be a simple way to do this job, but could not figure it out by myself.
Input file (thousand of... (3 Replies)
Hi Friends,
I have come across some files where some of the columns don not have data.
Key, Data1,Data2,Data3,Data4,Data5
A,5,6,,10,,
A,3,4,,3,,
B,1,,4,5,,
B,2,,3,4,,
If we see the above data on Data5 column do not have any row got filled. So remove only that column(Here Data5) and... (4 Replies)
Hello Members,
I have a csv file in the format below. Need help with awk statement to break nth column into 3 separate columns and export the changes to new file.
input file --> file.csv
cat file.csv|less
"product/fruit/mango","location/asia/india","type/alphonso"
need output in... (2 Replies)
I have a .CSV file with the below format:
"column 1","column 2","column 3","column 4","column 5","column 6","column 7","column 8","column 9","column 10
"12310","42324564756","a simple string with a , comma","string with or, without commas","string 1","USD","12","70%","08/01/2013",""... (2 Replies)
Hi,
I have a file of csv data, which looks like this:
file1:
1AA,LGV_PONCEY_LES_ATHEE,1,\N,1,00020460E1,0,\N,\N,\N,\N,2,00.22335321,0.00466628
2BB,LES_POUGES_ASF,\N,200,200,00006298G1,0,\N,\N,\N,\N,1,00.30887539,0.00050312... (10 Replies)
Hello Gentlemen,
Finding difficulties to play with my Input files:confused: . Your guidance will certainly help as always.
After converting to csv file from XLSM file, I am getting some extra ""(double quote) characters which I want to terminate inside shell script and process it further.
... (6 Replies)