I like this brain picking thingie ... if you guys could spice it up a lil' bit (abdallah). :)
On 5/2/05, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Walakum Alsalam Wa Rahmato Alah, > > I just want to make this clearer; now you're asking for "replacing" and > not greping; and so this is another question of the brain picking series > right? > > Ali Al-Khalidi > > Salam Ali > > > > > > How do I work on the same file but this time I am replacing a characher > > in the fisrt section ? > > > > I would like to replace every "|" with a "," but only in the left side. > > > > > > Abdallah > > > > > > > > > > > > > > ----- Original Message ----- > > From: [EMAIL PROTECTED] > > To: "Jordan Linux User Group Mailing list" <[email protected]> > > Subject: Re: [JoLUG-General] brain picking > > Date: Sat, 23 Apr 2005 13:47:57 +0300 (EEST) > > > >> > >> Salam Abdullah, > >> > >> Miss ya man, really; mail me updates on your status where you are. > >> > >> about the quiz: > >> File Format: > >> > >> ##some in section one##another in section two##yet another in three line > >> one > >> ##some in section one##another in section two##yet another in three line > >> two > >> > >> ./abdula.sh word file > >> > >> #!/bin/bash > >> grep "^##[[:space:][:alpha:]]*\($1\)[[:space:][:alpha:]]*##" $2 > >> > >> cheerz, > >> > >> Ali Al-Khalidi > >> > >> > >> > Salaam Alaikum Khamis Al3azeez > >> > > >> > Good morning to ya. > >> > > >> > True, but we are not working with dirs. They are hiarchical listings > >> of > >> > words in a text file. > >> > > >> > Any idea about the second quiz ? :) > >> > > >> > > >> > > >> > ----- Original Message ----- > >> > From: "Khamis Siksek" <[EMAIL PROTECTED]> > >> > To: "Jordan Linux User Group Mailing list" <[email protected]> > >> > Subject: Re: [JoLUG-General] brain picking > >> > Date: Sat, 23 Apr 2005 09:44:56 +0300 > >> > > >> >> > >> >> I think this is the fastest and the easiest > >> >> > >> >> find ./ -type d > >> >> > >> >> and a sorted list of directories will appear > >> >> > >> >> > >> >> > >> >> On 4/23/05, Abdallah <[EMAIL PROTECTED]> wrote: > >> >> > 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 > >> >> > > >> >> > >> >> > >> >> -- > >> >> > >> >> > >> >> Khamis Siksek > >> >> > >> >> When they thought of finding another name for FreeSoftware, they > >> >> thought of OpenSource and KhamisSiksek ... > >> >> . > >> >> . > >> >> . > >> >> They chose the wrong one :-( > >> >> > >> >> _______________________________________________ > >> >> 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 > >> > > >> > >> > >> _______________________________________________ > >> 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 > > > > _______________________________________________ > 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
