script to combine colums from multiple files

Chris F.A. Johnson cfaj-uVmiyxGBW52XDw4h08c5KA at public.gmane.org
Fri Sep 12 20:40:40 UTC 2008


On Fri, 12 Sep 2008, Neil Watson wrote:

> How would I go about cutting selected columns from multiple files and
> combining them into single file?  I so used to processing files line by
> line that this problem escapes me.

$ cat file1
1 4
2 5
3 6
$ cat file2
qw:er
ty:ui
as:df
$ paste -d, <(cut -d ' ' -f2 file1) <(cut -d: -f1 file2)
4,qw
5,ty
6,as

-- 
    Chris F.A. Johnson, webmaster         <http://woodbine-gerrard.com>
    ========= Do not reply to the From: address; use Reply-To: ========
    Author:
    Shell Scripting Recipes: A Problem-Solution Approach (2005, Apress)
--
The Toronto Linux Users Group.      Meetings: http://gtalug.org/
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://gtalug.org/wiki/Mailing_lists





More information about the Legacy mailing list