Abulyomon is the man. 

here is another way:

awk '{sub(/\/$/, "", $0) ; n=split($0, b, /\//) ; if (b[2]) for (y=1;y<=n;y++) 
{ printf b[1] ; for (z=2;z<=y;z++) printf filename

however, yours is faster. Thanks my frind. I did enjoy. 


Here is another one: 

A file 

##section 1 words## section 2 a bunch of words##section 3 other words
##section 1 words## section 2 a bunch of words##section 3 other words
##section 1 words## section 2 a bunch of words##section 3 other words

I would like to grep for words in section 1 only and if they match then output 
the whole line as is. 

:)

----- Original Message -----
From: "Yaman Saqqa" <[EMAIL PROTECTED]>
To: "Jordan Linux User Group Mailing list" <[email protected]>
Subject: Re: [JoLUG-General] brain picking
Date: Sat, 23 Apr 2005 02:56:15 +0200

> 
> mnee7 elli tzakkartna man ... it's really good to see ur name in 
> the list again.
> 
> btw .. here is the script .. enjoy
> 
> 
> [EMAIL PROTECTED] junk]$ cat data
> a/e/d/f/
> d/g/r/t/d/f/f/
> [EMAIL PROTECTED] junk]$ ./abdallah data
> a
> a/e
> a/e/d
> a/e/d/f
> d
> d/g
> d/g/r
> d/g/r/t
> d/g/r/t/d
> d/g/r/t/d/f
> d/g/r/t/d/f/f
> [EMAIL PROTECTED] junk]$ cat abdallah
> #!/bin/bash
> 
> DATAFILE=$1
> 
> for line in `cat $DATAFILE`
> do
>          PARTS=`echo $line | tr '/' ' ' | wc -w`
>          for ((part=1; part <= PARTS ; part++))
>          do
>                  echo $line | cut -d '/' -f -$part
>          done
> done
> 
> 
> On 4/23/05, Abdallah <[EMAIL PROTECTED]> wrote:
> > Assalam Alaikum Wr Wb
> >
> > How are you all?
> >
> > I have been following the list on and off since I left and I am 
> > so glad of the traffic it has. I can tell that you guys are up to 
> > no good. :D
> >
> > Anyway, I have a question for you guys.
> >
> > I have a file as such:
> >
> > a/e/d/f/
> > d/g/r/t/d/f/f/
> > ..
> > ..
> >
> >  How can I sort it to look like this:
> >
> > a
> > a/e
> > a/e/d
> > a/e/d/f
> > d
> > d/g
> > d/g/r
> > d/g/r/t
> > d/g/r/t/d
> > d/g/r/t/d/f
> > d/g/r/t/d/f/f
> > ....
> > .....
> >
> > how can I use tools like awk, sed, cut or whatever else you can 
> > think of ..... to do it?
> >
> > notice:
> > - that the letters could be words of various lengths.
> >
> > Abdallah
> >
> > --
> > ___________________________________________________________
> > Sign-up for Ads Free at Mail.com
> > http://promo.mail.com/adsfreejump.htm
> >
> > _______________________________________________
> > General mailing list
> > [email protected]
> > http://mail.jolug.org/mailman/listinfo/general_jolug.org
> >
> 
> 
> --
> abulyomon
> 
> www.KiLLTHeUPLiNK.com
> 
> _______________________________________________
> General mailing list
> [email protected]
> http://mail.jolug.org/mailman/listinfo/general_jolug.org

-- 
___________________________________________________________
Sign-up for Ads Free at Mail.com
http://promo.mail.com/adsfreejump.htm


_______________________________________________
General mailing list
[email protected]
http://mail.jolug.org/mailman/listinfo/general_jolug.org

Reply via email to