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

Re: 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

awk '{i = 0; while (i++ < NF) {if ($i ~ /downloads.sourceforge.net.*nvu/) print
$i}}' test-text.txt

-- 
Regards,
Jörg-Volker.


Reply to: