martin@localhost:~/2delete$ cat columns.txt
1 2 3
a b c
1 2 3 4
a b c d
martin@localhost:~/2delete$ awk '$2 == "b"' columns.txt
a b c
a b c d
martin@localhost:~/2delete$ awk '$2 == "2"' columns.txt
1 2 3
1 2 3 4
2009/2/11 Nagy Daniel <n.dani86@gmail.com>:
> Is there a methodfor searching in colums just like grep does in rows, but i
> don't know how many colums I will have, so: awk is not good, beacuse awk
> {print $1$2$3} it's not a good soultion:S i have too many colums
--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
02-14-2009, 09:59 AM
Jörg-Volker Peetz
Grep for colums?
Nagy Daniel wrote:
> the "text" is here:
>
> http://pastebin.com/f37214a30
>
> and I only want this string:
>
> http://downloads.sourceforge.net/portableapps/nvu_portable_1.0_rev_5_en-us.paf.exe?download
>
> so I want to search like:
> | grep downloads.sourceforge.net <http://downloads.sourceforge.net> |
> grep nvu
> but the text isn't separated with enters, and I want to search in
> columns, not in rows :S
>
Although there are already given very nice perl solutions, with awk an answer
for what you asked for is