Search Results

Search: Posts Made By: ahjiefreak
Forum: Programming 12-11-2008
8,668
Posted By ahjiefreak
Problem in static structure array in C
Hi,

I have a following problem in C.

I have a function A in which I used to call another function (function B) and pass an array of values through array variable by using below:-
...
5,729
Posted By ahjiefreak
Hi, Thanks for the suggestion. But I am...
Hi,

Thanks for the suggestion. But I am looking at solution for bash so I could pass the sorted array directly. I need to do some extra computation on the sorted array before printed out to a new...
5,729
Posted By ahjiefreak
Hi The first field is some other numbers...
Hi

The first field is some other numbers and the example happen to be somehow row number.

You are right..it is from field 2 to field 6.
5,729
Posted By ahjiefreak
Hi Joey, I meant sorting the field 2,field 3...
Hi Joey,

I meant sorting the field 2,field 3 ,field4 and field 5 for each line.

My example of input:-

1 6 4 8 2 3
2 1 9 3 2 1
3 3 5 6 3 1
4 9 7 8 2 3

Output:-
1 2 3 4 6 8
2 1 1 2 3 9...
5,729
Posted By ahjiefreak
Is there any better way for sorting in bash/awk
Hi,

I have a file which is:-

1 6 4 8 2 3
2 1 9 3 2 1
3 3 5 6 3 1
4 9 7 8 2 3

I would like to sort from field $2 to field $6 for each of the line to:-

1 2 3 4 6 8
2 1 1 2 3 9
3 1 3 3...
2,895
Posted By ahjiefreak
Thanks Era and cfajohnson, Appreciate alot. ...
Thanks Era and cfajohnson,

Appreciate alot.

But I have a question on the array..after I get that array, how could I know number of entries that the array hold?

I tried

for i in...
2,895
Posted By ahjiefreak
Hi, I have tried your suggestion by having...
Hi,

I have tried your suggestion by having that two arrays created. But when i did try echo ${yes[@]}, it print out the the command "grep yes$ myfile".

Is there any thing I missed out?
...
2,895
Posted By ahjiefreak
How to load different type of data in a file to two arrays
Hi,

I have tried to find some sort of previous similar thread on this but not quite close to what I want to achieve.

Basically I have two class of data in my file..e.g
1,1,1,1,1,2,yes...
6,389
Posted By ahjiefreak
Hi, My initial thought/idea was:- ...
Hi,

My initial thought/idea was:-

!/bin/awk

filename={apple.txt,orange.txt,bar.txt................}

for file in filename;do

while(getline<"file"); do

val+=$3;
count++;

done
...
6,389
Posted By ahjiefreak
Help in extracting multiple files and taking average at same time
Hi,

I have 20 files which have respective 50 lines with different values.

I would like to process each line of the 50 lines in these 20 files one at a time and do an average of 3rd field ($3)...
2,759
Posted By ahjiefreak
Hi, How do you decide which "orange" line to...
Hi,

How do you decide which "orange" line to duplicate? Is it always the first one?
> It is always taking from the first one.
E.g if the data have

1,2,3,4,5,6,apple
1,1,0,4,2,3,apple...
2,759
Posted By ahjiefreak
How to replicate data using Uniq or awk
Hi,

I have this scenario; where there are two classes:- apple and orange.

1,2,3,4,5,6,apple
1,1,0,4,2,3,apple
1,3,3,3,3,4,apple
1,1,1,1,1,1,orange
1,2,3,1,1,1,orange

Basically for apple,...
3,727
Posted By ahjiefreak
use awk to aggregrate the field number
Hi,

I have a various files;each filled with hundreds of line with similar number of fields.

I would like to extract out field $5 from each of this file and aggregate them before printing out to...
3,353
Posted By ahjiefreak
Hi., Which 0 in orange line do you mean. ...
Hi.,

Which 0 in orange line do you mean.

The example of data is :-

0, 0, 0, 0, 1, 2, 0, 4, 5, 6, 7,foo
0, 0, 0, 0, 1, 4, 0, 5, 5, 5, 5,foo1
0, 0, 6, 0, 1, 6, 0, 6, 1, 2, 3,orange
etc...
...
3,353
Posted By ahjiefreak
Hi, I wanted to have common zeros occuring...
Hi,

I wanted to have common zeros occuring in rows of data to be eliminated at all. Dont have to be trim of any factor.

Currently, I am thinking of using awk with NF and NR.


awk -F FS={,}...
3,353
Posted By ahjiefreak
Hi, Actually, the data I have previously is...
Hi,

Actually, the data I have previously is just an analogy.

In real case, i have this file of thousands of rows of numbers ending with a text.


Please advise.
3,353
Posted By ahjiefreak
How to strip out common terms in string
Hi,

I have this kinda of data:-

0,0,0,0,1,2,0,4,5,6,7,foo
0,0,0,0,1,4,0,5,5,5,5,foo1
0,0,6,0,1,6,0,6,1,2,3,orange
etc...

I wanted to remove the 0 which occur on the same rows of foo,foo1...
2,466
Posted By ahjiefreak
How to do a find number of files in awk
Hi,

How can i able to do a similar operation to "find" number of files in a folder in an awk?

In bash, we could do easily using "find" command. But currently, I am having an awk block and i...
17,473
Posted By ahjiefreak
How to transpose a table of data using awk
Hi.

I have this data below:-
v1 28 14 1.72414 1.72414 1.72414 1.72414 1.72414
v2 77 7 7.47126 6.89655 6.89655 6.89655 6.89655
v3 156 3 21.2644 21.2644 20.6897 21.2644 20.6897
v4 39 3 1.72414...
3,847
Posted By ahjiefreak
Hi Jean, Thanks for the reply. I havent try...
Hi Jean,

Thanks for the reply. I havent try the suggested solution but I am thinking how is that possible if i have about 30 files to perform the above operation.

Is that possible the first...
3,847
Posted By ahjiefreak
Hi Annihilannic. I still could not get the...
Hi Annihilannic.

I still could not get the right output.

It doesnt combine the third element until the last line read from the first directory's file.

I modified to be something like below:-...
3,847
Posted By ahjiefreak
How to combine data files using for loop
Hi,

I have 5 files basically;namely file1.txt situated each at folder A to E respectively.

I would like to extract out third column from each of these file1.txt from folder A to folder E....
4,352
Posted By ahjiefreak
Hi, Supposedly in the test.txt, the desired...
Hi,

Supposedly in the test.txt, the desired result would print out:-

foo, 1,2,4

In the above case, we dont consider the score to have any similarities in other lines, so it only checks the...
4,352
Posted By ahjiefreak
How to extract elements using Awk
Hi,

I have this typical extraction problem in AWK.

I have 3 input files..

i) First one is somehow like an oracle of:-
foo 12,23,24
bla 11,34
car 35

ii)Second file is basically...
4,604
Posted By ahjiefreak
How to read and compare multiple fields in a column at the same time
Hi,

Currently I am coding up a nasty way of reading file input using *cat* rather than *read*. My text input looks like

TextA 100
TextB 110
TextC 120

Currently I am using cat |while read...
Showing results 1 to 25 of 130

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