Re: awk print

2005-02-24 Thread FreeBSD questions mailing list
On 24 feb 2005, at 12:39, Soheil Hassas Yeganeh wrote:
You can set $[1..n] to "" and then print
find ./ -name "stuff" | awk '{ $1=""; $2=""; print}
On Wed, 23 Feb 2005 22:41:32 -0500, Mark Frank 
<[EMAIL PROTECTED]> wrote:
* On Wed, Feb 23, 2005 at 07:36:05PM -0700 David Bear wrote:
On Wed, Feb 23, 2005 at 11:19:26PM +0100, Roland Smith wrote:
On Wed, Feb 23, 2005 at 02:40:10PM -0700, David Bear wrote:
I'm using awk to parse a directory listing. I was hoping there is a
way to tell awk to print from $2 - to the end of the columns
available.
find ./ -name '*stuff' | awk '{FS="/" print $3---'}
Is this what you mean?:
find ./ -name '*stuff'|sed 's|\.[^/]*/[^/]*/||g'
thanks for the advice. No, this doesn't do what I want.
If I have a directory path /stuff/stuff/more/stuff/more/and/more
that is n-levels deep, I want to be able to cut off the first two
levels and print the from 2 to the Nth level.
So how about cut?
find ./ -name '*stuff'| cut -d/ -f4-
Mark
or if you insist on using awk:
find ./ -name '*stuff' |  awk '{for (i=3; i<=NF; i++) printf " %s", $i; 
printf "\n" }'

Arno
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: awk print

2005-02-24 Thread Soheil Hassas Yeganeh
You can set $[1..n] to "" and then print 
find ./ -name "stuff" | awk '{ $1=""; $2=""; print}


On Wed, 23 Feb 2005 22:41:32 -0500, Mark Frank <[EMAIL PROTECTED]> wrote:
> * On Wed, Feb 23, 2005 at 07:36:05PM -0700 David Bear wrote:
> > On Wed, Feb 23, 2005 at 11:19:26PM +0100, Roland Smith wrote:
> > > On Wed, Feb 23, 2005 at 02:40:10PM -0700, David Bear wrote:
> > > > I'm using awk to parse a directory listing. I was hoping there is a
> > > > way to tell awk to print from $2 - to the end of the columns
> > > > available.
> > > >
> > > > find ./ -name '*stuff' | awk '{FS="/" print $3---'}
> > >
> > > Is this what you mean?:
> > >
> > > find ./ -name '*stuff'|sed 's|\.[^/]*/[^/]*/||g'
> >
> > thanks for the advice. No, this doesn't do what I want.
> >
> > If I have a directory path /stuff/stuff/more/stuff/more/and/more
> > that is n-levels deep, I want to be able to cut off the first two
> > levels and print the from 2 to the Nth level.
> 
> So how about cut?
> 
> find ./ -name '*stuff'| cut -d/ -f4-
> 
> Mark
> 
> --
> "The fix is only temporary...unless it works." - Red Green
> ___
> freebsd-questions@freebsd.org mailing list
> http://lists.freebsd.org/mailman/listinfo/freebsd-questions
> To unsubscribe, send any mail to "[EMAIL PROTECTED]"
>
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: awk print

2005-02-23 Thread Mark Frank
* On Wed, Feb 23, 2005 at 07:36:05PM -0700 David Bear wrote:
> On Wed, Feb 23, 2005 at 11:19:26PM +0100, Roland Smith wrote:
> > On Wed, Feb 23, 2005 at 02:40:10PM -0700, David Bear wrote:
> > > I'm using awk to parse a directory listing. I was hoping there is a
> > > way to tell awk to print from $2 - to the end of the columns
> > > available. 
> > > 
> > > find ./ -name '*stuff' | awk '{FS="/" print $3---'}
> > 
> > Is this what you mean?:
> > 
> > find ./ -name '*stuff'|sed 's|\.[^/]*/[^/]*/||g'
> 
> thanks for the advice. No, this doesn't do what I want.
> 
> If I have a directory path /stuff/stuff/more/stuff/more/and/more
> that is n-levels deep, I want to be able to cut off the first two
> levels and print the from 2 to the Nth level.

So how about cut?

find ./ -name '*stuff'| cut -d/ -f4-

Mark

-- 
"The fix is only temporary...unless it works." - Red Green
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


Re: awk print

2005-02-23 Thread David Bear
On Wed, Feb 23, 2005 at 11:19:26PM +0100, Roland Smith wrote:
> On Wed, Feb 23, 2005 at 02:40:10PM -0700, David Bear wrote:
> > I'm using awk to parse a directory listing. I was hoping there is a
> > way to tell awk to print from $2 - to the end of the columns
> > available. 
> > 
> > find ./ -name '*stuff' | awk '{FS="/" print $3---'}
> 
> Is this what you mean?:
> 
> find ./ -name '*stuff'|sed 's|\.[^/]*/[^/]*/||g'

thanks for the advice. No, this doesn't do what I want.

If I have a directory path /stuff/stuff/more/stuff/more/and/more
that is n-levels deep, I want to be able to cut off the first two
levels and print the from 2 to the Nth level.

> 
> Roland
> -- 
> R.F. Smith   /"\ASCII Ribbon Campaign
> r s m i t h @ x s 4 a l l . n l  \ /No HTML/RTF in e-mail
> http://www.xs4all.nl/~rsmith/ X No Word docs in e-mail
> public key: http://www.keyserver.net / \Respect for open standards



-- 
David Bear
phone:  480-965-8257
fax:480-965-9189
College of Public Programs/ASU
Wilson Hall 232
Tempe, AZ 85287-0803
 "Beware the IP portfolio, everyone will be suspect of trespassing"
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"


awk print

2005-02-23 Thread David Bear
I'm using awk to parse a directory listing. I was hoping there is a
way to tell awk to print from $2 - to the end of the columns
available. 

find ./ -name '*stuff' | awk '{FS="/" print $3---'}

the $3-- I want to mean -- print from col 3 to the end.

Any awk pros?

-- 
David Bear
phone:  480-965-8257
fax:480-965-9189
College of Public Programs/ASU
Wilson Hall 232
Tempe, AZ 85287-0803
 "Beware the IP portfolio, everyone will be suspect of trespassing"
___
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "[EMAIL PROTECTED]"