FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Debian > Debian User

 
 
LinkBack Thread Tools
 
Old 02-11-2009, 10:09 AM
Nagy Daniel
 
Default Grep for colums?

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
 
Old 02-11-2009, 10:26 AM
Nagy Daniel
 
Default Grep for colums?

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 | grep nvu
but the text isn't separated with enters, and I want to search in columns, not in rows :S

2009/2/11 Γιώργος *άλλας <gpall@ccf.auth.gr>

Nagy Daniel wrote:




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







There is always perl!



If you send an example of what you want, I can hack you quickly a 5 line perl script to do the job...



G.
 
Old 02-11-2009, 11:34 AM
Johann Spies
 
Default Grep for colums?

On Wed, Feb 11, 2009 at 12:26:07PM +0100, Nagy Daniel wrote:
> the "text" is here:
>
> http://pastebin.com/f37214a30

I have copied that into a file /tmp/w

>
> and I only want this string:
>
> http://downloads.sourceforge.net/portableapps/
> nvu_portable_1.0_rev_5_en-us.paf.exe?download

% grep -o 'nvu_portable_1.0_rev_5_en-us.paf.exe?download' /tmp/w
nvu_portable_1.0_rev_5_en-us.paf.exe?download


Regards
Johann

--
Johann Spies Telefoon: 021-808 4036
Informasietegnologie, Universiteit van Stellenbosch

"Make a joyful noise unto the LORD, all ye lands.
Serve the LORD with gladness: come before his presence
with singing. Know ye that the LORD he is God: it is
he that hath made us, and not we ourselves; we are his
people, and the sheep of his pasture."
Psalms 100:1-3


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 02-11-2009, 03:25 PM
Paul E Condon
 
Default Grep for colums?

On 2009-02-11_12:09:20, Nagy Daniel wrote:
> 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

Yes, and its call SQL. If you only want to do one or two searches, you
can use perl, or awk, coreutils, etc., but if getting accurate and
reproducible results is important to you, you will need some serious
computational machinery.

Also, in awk, use {print $1, $2, $3 ;} to keep the space delimiter
between columns. And learn about the built-in variable NF. Its value
is always set to the number of fields (columns) in the current line.

HTH

--
Paul E Condon
pecondon@mesanetworks.net


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 02-11-2009, 05:11 PM
Michael Iatrou
 
Default Grep for colums?

When the date was Wednesday 11 February 2009, 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-u
>s.paf.exe?download

It seems to me that you only want to grab urls. This should (kind of) do the
trick:

cat f37214a30.txt | perl -ne 'print "$1
" if (/href="(.+?)"/ig)'

f37214a30.txt is a file with the snippet you uploaded.

--
Μιχάλης Ιατρού (tljw)


--
To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 
Old 02-11-2009, 10:42 PM
Nagy Daniel
 
Default Grep for colums?

Thank you!!!

The solution was this:




cat text.txt | perl -ne 'print "$1
" while (/href="" | grep sourceforge | grep nvu




2009/2/11 Michael Iatrou <m.iatrou@freemail.gr>

When the date was Wednesday 11 February 2009, 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-u

>s.paf.exe?download



It seems to me that you only want to grab urls. This should (kind of) do the

trick:



cat f37214a30.txt | perl -ne 'print "$1
" if (/href="">


f37214a30.txt is a file with the snippet you uploaded.



--

*Μιχάλης Ιατρού (tljw)





--

To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org

with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
 

Thread Tools




All times are GMT. The time now is 06:37 PM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org