[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: which is the best command to use



lina <lina.lastname@gmail.com> wrote:
> Thanks cool. a derived question,

> for a.txt:
> 1 a
> 2 a
> 3 a

> for b.txt
> 1 b
> 2 b
> 3 b

> what if I only interested the 2 filed.

> namely
> a b
> a b
> a b

Are the 1, 2, 3 relevant? So if you had this, what would you expect as
your output -

a.txt
1 a
2 b
3 c

b.txt
1 d
2 e
3 f


> I tried use paste -d ' ' a.txt b.txt | awk 'print $2, $4'
> are there some other way of doing it?

That's good if the numeric column is irrelevant. You could use cut
instead of awk, but it gets you much the same result. (You could replace
the paste and the awk with a single instance of perl, but frankly I
wouldn't make the effort for this kind of situation.)

Chris


Reply to: