![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
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 |
| Development Releases: Linux Mint 4.0 Beta "Fluxbox", 4.0 Alpha "Debian" | iBot | UNIX and Linux RSS News | 0 | 01-04-2008 03:00 PM |
| Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`" | Lokesha | UNIX for Dummies Questions & Answers | 4 | 12-20-2007 01:52 AM |
| how could i make a program mixed with many "|", "<" and ">" | strugglingman | High Level Programming | 2 | 04-29-2006 08:11 AM |
| No utpmx entry: you must exec "login" from lowest level "shell" | peterpan | UNIX for Dummies Questions & Answers | 0 | 01-18-2006 04:15 AM |
| join two lines when the second line contains "US DOLLAR" | powah | Shell Programming and Scripting | 2 | 10-21-2005 06:30 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Help~~join and "multijoin"
Hi , all
join command can join 2 files, but what about "multijoin"?? if a list of files and an integer are given as input, how to join these files and sort them according to the field number of this integer. Default field is the join field for all the joins. example: file 1 = Chris King file 2 = Chris Funny file 3 = Chris Small Chris Big >multijoin file1 file2 file3 -k 4 result: Chris King Funny Big Chris King Funny Small So, first step is to join file1 and file2, then put it in a file, may call it file10, then join it with file 3, right? but for it's recursive, i cann't do like this for i in $* join $i $i+1 like in other programming languages. so how to make the output of last join joined with the next file, i really get confused~ well, it's a homework problem, so does anyone have idea?? thanks in advance Tracy |
|
||||
|
please try the script below
if the input file is file1 through file3 multijoin.sh #!/usr/bin/ksh c=1 for f in file? do if [[ c -eq 1 ]]; then cat $f > tmp c=2 else join $f tmp > tmp1 mv tmp1 tmp fi done cat tmp rm tmp |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|