Gentoo Archives: gentoo-user

From: "Cláudio Henrique" <rapaduraatomica@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] OT: awk scripting
Date: Fri, 24 Mar 2006 15:19:00
Message-Id: 7babdf270603240637q402075d8m87387f683a54e7cf@mail.gmail.com
In Reply to: [gentoo-user] OT: awk scripting by Sascha Lucas
1 let's say you have a listing like this in a file name list.txt:
2
3 aaa bbb
4 aaa bbb
5 aaa bbb
6 aaa bbb
7 aaa bbb
8
9 if you wanna print the "bbb" column, you just have to do like this:
10
11 cat list.txt | awk '{ print $2 }'
12
13 if the listing is like this:
14
15 aaa;bbb
16 aaa;bbb
17 aaa;bbb
18 aaa;bbb
19 aaa;bbb
20
21 then you do:
22
23 cat list.txt | awk -F';' '{ print $2 }'
24
25 and so on. I sugest you read awk and gawk man pages for more info.
26 they are very complete.
27
28 regards, claudio.
29
30
31 On 3/24/06, Sascha Lucas <sascha.lucas@×××××××××××××××××.de> wrote:
32 > Hi list,
33 >
34 > I want the awk analogon for "cut -f2-", which prints fields #2 to #n. Is
35 > this possible?
36 >
37 > awk '{print $2???}'
38 >
39 > TIA,
40 >
41 > Sascha.
42 >
43 > --
44 > gentoo-user@g.o mailing list
45 >
46 >
47
48 --
49 gentoo-user@g.o mailing list