Let's say that I have a database that I call part ID. This database has the following grouping:
I want to write a program that would read this database and tell me when the 3rd item of each group is smaller than the second item of the same group or when the 1st item is greater than the 2nd item of that group. Basically item1 < item2 < item3 is the standard within the same group. If this is not met within that group, The script would print the output of all the groups that are different. For example, the output would be:
Any suggestions will be appreciated!
Thanks!
Last edited by Scott; 05-18-2010 at 01:28 PM..
Reason: Code tags, please...
... Basically item1 < item2 < item3 is the standard within the same group. If this is not met within that group, The script would print the output of all the groups that are different. ...
Your script works. But I still have some issues. After I ran my surveys, my output file is as follows:
F
I used this sed command
to make it look like this
However it won’t do it. With the commas in the format, your script does not work; with the equal sign, it works. Any idea what I am doing wrong?
---------- Post updated at 11:24 AM ---------- Previous update was at 09:46 AM ----------
Disregard my previous posting. I mistakenly enterer a comma instead of a semicolon. That's why it was not working.
Thanks!
---------- Post updated at 11:31 AM ---------- Previous update was at 11:24 AM ----------
Now, if you could explain the script to me, that would help. I need to modify it somehow. Basically what I am trying to do is to the following:
The output data for all the groups has 6 entries.But while most of the groups has only three entries filled, some groups have all 6 entries filled. What I want to do is Whenever the script reads the file and sees a group with only 3 entries filled, it needs to print the three rows that have data but strip the other three empty rows; for the groups with 6 entries filled, it just needs to print them out. That would be fantastic if you or someone else could help.
Thanks!
---------- Post updated at 07:56 PM ---------- Previous update was at 11:31 AM ----------
Hey rdcwayx,
I tried your script but got this error message.
For your info, my input file format was as follows:
Keep in mind that this represents a fraction of a huge database.
Let me know what you think.
Thanks!
Last edited by Scott; 05-19-2010 at 07:32 PM..
Reason: Code tags again...
... Basically what I am trying to do is to the following:
The output data for all the groups has 6 entries.But while most of the groups has only three entries filled, some groups have all 6 entries filled. What I want to do is Whenever the script reads the file and sees a group with only 3 entries filled, it needs to print the three rows that have data but strip the other three empty rows; for the groups with 6 entries filled, it just needs to print them out. ...
For your info, my input file format was as follows:
554.3=432
554.2=264
554.1=96
555.3=452
555.2=284
555.1=116
556.3=488
556.2=320
556.1=152
557.3=340
557.2=172
557.1=4
558.3=356
558.2=188
558.1=20
559.3=108
559.2=276
559.1=444
...
Firstly, the Perl one-liner posted earlier will *not* work for groups of 6 lines. It works *only* for groups of 3 lines.
Secondly, it may be beneficial if you could post some test data for groups of 3 lines as well as 6 lines. And post the output as well that shows what exactly is to be done for each group.
The input you've posted above is difficult to comprehend because it does not have the blank line that separates one group from the other.
Okay, I have 6 groups. Now I want the script to go through these groups and look at the structure of each group. If the .1 (within a group) is greater than the .2 or .3 OR if .2 is greater than .3 within a group; thus output these groups. In our case the output would be groups.
input file Output file
I hope it is clear enough.
Last edited by vgersh99; 05-19-2010 at 07:29 PM..
Reason: code tags, please!
Hii guys,
I need to sort my file and remove duplicates before writing to another file. The first line in the file are column names. I dont want this line to be sorted and should always be the first line in the output.
sort -u file.txt > file1.txt. is the command that i am using... (4 Replies)
Hi, Please i need help in writing an 'awk' script in sorting the following data;
traceroute6 to 2001:1ba0:2a0:5965:0:30:24:1 (2001:1ba0:2a0:5965:0:30:24:1) from 2001:418:1::62, 64 hops max, 16 byte packets
1 2001:418:1::4 0.342 ms
2 2001:418:1::1 0.630 ms
3 2001:504:16::1b1b 0.393 ms
4... (6 Replies)
Hi all,
Does anyone can help me the following question? I would like to write an AWK script.
In the following input file, each number in "start" is paired with numbers in column "end".
No Start End
A 22,222,33,22,1233,3232,44 555,333,222,55,1235,3235,66... (7 Replies)
Hi, I have posted related topic but as i continue the research I find more need to sort the data.
AS(2607:f278:4101:11:dead:beef:f00f:f), AS786 AS6453 AS7575 AS7922
AS(2607:f2e0:f:1db::16), AS786 AS3257 AS36252
AS786 AS3257 AS36252
AS(2607:f2f8:1700::2), AS786 AS6939 AS25795 ... (6 Replies)
hi everyone, I am kind of new to this forum. I need help in sorting this data out accordingly, I am actually doing a traceroute application and wants my AS path displayed in front of my address like this;
192.168.1.1 AS28513 AS65534 AS5089 AS5089 .... till the last AS number and if possible... (1 Reply)
hi everyone, I am kind of new to this forum. I need help in sorting this data out accordingly, I am actually doing a traceroute application and wants my AS path displayed in front of my address like this;
192.168.1.1 AS28513 AS65534 AS5089 AS5089 .... till the last AS number and if possible... (1 Reply)
i have list of files:
Wang De Wong CVPR 09.pdf
Yaacob AFGR 99 Second edition.pdf
Shimon CVPR 01.pdf
Den CCC 97 long one.pdf
Ronald De Bour CSPP 04.pdf
.....
how can i sort this directory so the output will be in the next format:
<year>\t<conference/journal>\t<author list> - t is tab
(its... (1 Reply)
i have list of files:
Wang De Wong CVPR 09.pdf
Yaacob AFGR 99 Second edition.pdf
Shimon CVPR 01.pdf
Den CCC 97 long one.pdf
Ronald De Bour CSPP 04.pdf
.....
how can i sort this directory so the output will be in the next format:
<year>\t<conference/journal>\t<author list> - t is tab
(its... (1 Reply)
how can i sort the next list just by look at the numbers (ignore letters)
example:
abc123
dff4f
aaa2aa
bbbb55555bb
output:
aaa2aa
dff4f
abc123
bbbb55555bb (1 Reply)
hey,
I have a file that looks smthng like this:
/*--- abcd_0050 ---*/
asdfjk
adsfkja
lkjljgafsd
/*---abcd_0005 ---*/
lkjkljbfkgj
ldfksjgf
dfkgfjb
/*-- abcd_0055--*/
klhfdghd
dflkjgd
jfdg
I would like it to be sorted so that it looks like this:
/*---abcd_0005 ---*/
lkjkljbfkgj (9 Replies)