The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #4 (permalink)  
Old 04-28-2008
era era is offline Forum Advisor  
Herder of Useless Cats (On Sabbatical)
  
 

Join Date: Mar 2008
Location: /there/is/only/bin/sh
Posts: 3,652
If your shell supports it:


Code:
paste <(cut -f2 file1.txt) <(cut -f2 file2.txt)

If you can't get the <(...) syntax to work, you will need temporary files, at least for one of the cuts.


Code:
cut -f2 file1.txt >tmp
cut -f2 file2.txt | paste tmp -

cut and paste normally work on tab-delimited input; if you have variable amounts of spaces as separators, awk is definitely the way to go.