![]() |
|
|
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 |
| doubt in /etc/inittab script | esham | Shell Programming and Scripting | 3 | 04-17-2009 01:38 PM |
| i have a doubt with the awk script?? | asirohi | UNIX for Advanced & Expert Users | 2 | 07-01-2008 11:19 PM |
| shell script doubt | ravi raj kumar | Shell Programming and Scripting | 5 | 12-05-2007 05:16 AM |
| colors in BASH, doubt with script | jaduks | Shell Programming and Scripting | 4 | 11-19-2007 05:21 AM |
| perl doubt plz explain.... | zedex | Shell Programming and Scripting | 1 | 09-03-2007 04:14 AM |
| View Poll Results: Perl | |||
| Learn |
|
0 | 0% |
| Continuous practice |
|
1 | 50.00% |
| Achieve |
|
0 | 0% |
| Go ahead |
|
1 | 50.00% |
| Voters: 2. You may not vote on this poll | |||
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Dear friends,
I have two files. In first file first column ($1), i have numbers. The second file containes, the same number in the fourth column($4). I need a output file, matching the first file column 1 with second file column 4. The main thing is the output file lines will be sorted without changing the line. Eg: File1: 123 124 125 File 2: we are at 123 from unix we are at 124 from linux we are at 123 at script we are at 567 at perl we are at 125 at awk Desired Output: we are at 123 from unix we are at 123 at script we are at 124 from linux we are at 125 at awk |
|
||||
|
not sorting, search and to do arithmetic..
Hi thanks,
But my question is not like sorting. I am explaining little detaily: FIle 1: 123 678 345 hi 6798 452 789 256 bi 8746 145 689 124 ji 435 456 690 345 ki 789 File 2: 345 256 124 Expected Output: The outfile should rearrange according to the fourth column of file1, matching with the first column of file2. Like: 123 678 345 hi 6798 456 690 345 ki 789 452 789 256 bi 8746 145 689 124 ji 435 Then the column 5 should be added for 345 matching individuallly, 256 invidually, 124 individually. Like: the addition of 345 match 5th column is 6798+789 = 7587 the addition of 256 macth 5th column is 8746 the addition of 124 match 5th column is 435 Thanks in advance for your reply, Vasanth |
|
||||
|
This question is asked a lot here, although the answer is usually in awk. Search for NR==FNR and throw in Perl to see how it's done in Perl.
http://www.unix.com/cfmgoogle.php?cx...sa=Search#1061 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|