![]() |
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to delete particular rows from a file | suresh3566 | Shell Programming and Scripting | 5 | 06-02-2008 06:07 AM |
| duplicate rows in a file | infyanurag | Shell Programming and Scripting | 3 | 05-22-2008 01:39 AM |
| How to append a Value to all the rows in a file | dsshishya | Shell Programming and Scripting | 2 | 03-20-2008 05:04 PM |
| alternate rows of a file | dr46014 | Shell Programming and Scripting | 3 | 08-25-2007 07:16 AM |
| how to find a word repeated in a file | gurukottur | UNIX for Dummies Questions & Answers | 4 | 08-24-2006 05:53 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hi everybody:
Could anybody tell me how I can delete repeated rows from a file?, this is, for exemple I have a file like this: 0.490 958.73 281.85 6.67985 0.002481 0.490 954.833 283.991 8.73019 0.002471 0.590 950.504 286.241 6.61451 0.002461 0.690 939.323 286.112 6.16451 0.00246 0.790 928.17 285.71 5.87057 0.002451 0.890 917.196 285.503 5.6777 0.002441 0.990 906.277 284.498 5.46275 0.00244 1.090 895.529 283.818 5.43785 0.002431 1.190 884.757 283.098 5.36579 0.002421 1.290 874.22 282.2 5.33933 0.00242 1.390 863.667 281.35 5.01376 0.002411 1.490 853.3 280.55 4.61738 0.00241 1.590 842.962 279.95 4.27487 0.002401 1.690 832.775 279.362 3.77744 0.002391 1.790 822.634 278.532 3.78002 0.00239 1.890 812.608 277.625 3.98339 0.002381 1.990 802.735 276.995 4.17061 0.00238 2.090 792.845 276.65 4.77151 0.002389 .. .. in this case I only would like this: 0.490 958.73 281.85 6.67985 0.002481 0.590 950.504 286.241 6.61451 0.002461 0.690 939.323 286.112 6.16451 0.00246 0.790 928.17 285.71 5.87057 0.002451 0.890 917.196 285.503 5.6777 0.002441 0.990 906.277 284.498 5.46275 0.00244 1.090 895.529 283.818 5.43785 0.002431 1.190 884.757 283.098 5.36579 0.002421 1.290 874.22 282.2 5.33933 0.00242 1.390 863.667 281.35 5.01376 0.002411 1.490 853.3 280.55 4.61738 0.00241 1.590 842.962 279.95 4.27487 0.002401 1.690 832.775 279.362 3.77744 0.002391 1.790 822.634 278.532 3.78002 0.00239 1.890 812.608 277.625 3.98339 0.002381 1.990 802.735 276.995 4.17061 0.00238 2.090 792.845 276.65 4.77151 0.002389 .. .. Note that the pattern that it repeat is $1 and I would like the first value that appear. Thanks a lot and cheers . ![]() |
|
||||
|
GNU awk: Code:
awk '{ a[$1]=$0 }
END{
n = asort(a)
for (i=1;i<=n;i++) print a[i]
}
' "file"
Quote:
Quote:
|
|
||||
|
Hi all
now my script is ok. But I have a problem. When I run the sed command: sed -f /tmp/delete EVDO_A12.users Everthing that changed only display on the screen. The input file EVDO_A12.users didn't change any thing. Which problem ? |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|