Puppy Linux Discussion Forum Forum Index Puppy Linux Discussion Forum
Puppy HOME page : puppylinux.com
"THE" alternative forum : puppylinux.info
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

The time now is Sat 19 Apr 2014, 14:22
All times are UTC - 4
 Forum index » House Training » Users ( For the regulars )
SCLISS - Simple Command LIne Search Script
Moderators: Flash, Ian, JohnMurga
Post new topic   Reply to topic View previous topic :: View next topic
Page 1 of 2 [19 Posts]   Goto page: 1, 2 Next
Author Message
01micko


Joined: 11 Oct 2008
Posts: 7547
Location: qld

PostPosted: Fri 02 Jul 2010, 01:46    Post subject:  SCLISS - Simple Command LIne Search Script  

What is SCLISS???

Well it is a Simple Command LIne Search Script

It's nothing fancy, it just searches a certain directory for a particular word or string.

It came about because I had to find something in some source code.. daunting!

It is based on a simple "grep" call. Technosaurus gave me the idea.

Plus, now I have added a basic usage of the find command to find files.

I made it for my own use but I thought I'd share it. I'm posting it here in the "users/regulars" section because it's not for everybody. It's a command line tool, but it does demonstrate that the command line can be fun. We get so used to pointing and clicking that we forget where the real power of Puppy, and all *nix for that matter lies. This script needn't be run in GUI mode, it should work fine in console mode.

If you read the script you will see how I used the different coloured texts, backgrounds and font weight. I put a link in the script.

It's quite functional for my purposes. As always, feel free to hack, improve, repost. Cool

Just untar the tarball and drop the script in your $PATH. I normally use /usr/sbin or /usr/bin for these sorts of things.

Cheers

Changelog
0.1.1 -little bug when typing dir
0.2 -just some more fun with colours and the hitlist returns the number of entries. Google look out! Laughing
-the colour layout is more organised, you could copy the table of vars to any script, or even make an *rc file for your scripts to read.
0.3 -things are evolving. Defined colours as vars to make code more human readable
-added capability to save to file, as an option
-fixed a bug with some versions of 'wc'. Sometimes the output has leading whitespace, hence 'cut' was failing. Changed call to 'awk'
-added more messages, just for fun
0.4 - added find command usage, fairly basic though.
-made a "bash_colors.rc" file installed to /etc, it can work for any shell based program. So any you can use this for your shell scripts... Please do!
_And.. because of that it's a .pet now, installs to /usr/sbin, the rc in /etc
0.5 - added line numbers to word/string search result, thx ttuuxxx
Embarassed , 1 person got 0.5, it was wrong, reuploaded
scliss-0.5.pet
Description  latest
pet

 Download 
Filename  scliss-0.5.pet 
Filesize  4.21 KB 
Downloaded  254 Time(s) 
scliss-0.4.pet
Description 
pet

 Download 
Filename  scliss-0.4.pet 
Filesize  4.18 KB 
Downloaded  431 Time(s) 
scliss.png
 Description   in action
 Filesize   20.16 KB
 Viewed   1394 Time(s)

scliss.png

scliss-0.3.tar.gz
Description 
gz

 Download 
Filename  scliss-0.3.tar.gz 
Filesize  1.93 KB 
Downloaded  411 Time(s) 
scliss-0.2.tar.gz
Description 
gz

 Download 
Filename  scliss-0.2.tar.gz 
Filesize  1.38 KB 
Downloaded  416 Time(s) 
scliss-0.1.1.tar.gz
Description 
gz

 Download 
Filename  scliss-0.1.1.tar.gz 
Filesize  990 Bytes 
Downloaded  415 Time(s) 
scliss.jpg
 Description   
 Filesize   55.37 KB
 Viewed   1486 Time(s)

scliss.jpg


_________________
Woof Mailing List | keep the faith Cool |

Last edited by 01micko on Mon 03 Jan 2011, 05:42; edited 9 times in total
Back to top
View user's profile Send private message Visit poster's website 
russoodle


Joined: 12 Sep 2008
Posts: 639
Location: Down-Under in South Oz

PostPosted: Fri 02 Jul 2010, 02:41    Post subject:  

Thank you Smile
_________________
This aging business really bugs me - it didn't bother me years ago, so why is it happening now??
meownplanet - puppylinuxstuff
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7547
Location: qld

PostPosted: Fri 02 Jul 2010, 10:03    Post subject:  

russoodle wrote:
Thank you Smile


My pleasure Suz

It combines my Puppy Loves.. eye candy, scripting and humour, in no specific order.

New ver posted. More fun!

Cheers

Mick

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
01micko


Joined: 11 Oct 2008
Posts: 7547
Location: qld

PostPosted: Sun 04 Jul 2010, 18:59    Post subject:  

Version 3

Fixes some bugs, added capability to save to FILENAME, where FILENAME is the word you used for the search or the first word in you search string. Added some more messages just for fun. Defined colours as vars to make the code human readable.

Have fun Smile

Cheers

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
01micko


Joined: 11 Oct 2008
Posts: 7547
Location: qld

PostPosted: Mon 05 Jul 2010, 05:46    Post subject:  

v-0.4

Now a .pet!

Added -f option which calls the "find" command, very basic usage though, but it does find files.

Made the colours into an rc file which installs to /etc. This is great for any shell script, though different versions, the colours might be slightly different.

Reference http://edoceo.com/liber/linux-bash-shell

Enjoy!

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
Béèm


Joined: 21 Nov 2006
Posts: 11782
Location: Brussels IBM Thinkpad R40, 256MB, 20GB, WiFi ipw2100. Frugal Lin'N'Win

PostPosted: Mon 05 Jul 2010, 08:54    Post subject:  

Nice.
I installed in lucid 208 and if I saw well, I should have gotten a menu entry in filesystem. Maybe I misinterpreted.
As it wasn't the case, I ran the script in a terminal.
With -f even a search with partial name can be done. (tried *fsck and got hits)
Note: the search argument is case sensitive. fsck isn't the same as Fsck.

_________________
Time savers:
Find packages in a snap and install using Puppy Package Manager (Menu).
Consult Wikka
Use peppyy's puppysearch
Back to top
View user's profile Send private message 
01micko


Joined: 11 Oct 2008
Posts: 7547
Location: qld

PostPosted: Mon 05 Jul 2010, 09:13    Post subject:  

Hi Béèm

No, no menu entry, this is purely command line stuff, Smile . I think there is a small bug in PPM which reads certain pets as needing a menu entry when actually they do not. I will take a look at that.

Thanks for the comment, I should mention in the help (-h) that the wildcard (*) is handy, Wink , especially for partial filenames.

Cheers

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
abushcrafter


Joined: 30 Oct 2009
Posts: 1447
Location: England

PostPosted: Fri 09 Jul 2010, 11:42    Post subject:  

Could you add the option of being able to search for part of a phase of a file/folder name or contents of a file(s) eg. phase="test" file name that has phase="testresultsofcommand".
_________________
adobe flash is rubbish!
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/
Back to top
View user's profile Send private message Visit poster's website 
01micko


Joined: 11 Oct 2008
Posts: 7547
Location: qld

PostPosted: Fri 09 Jul 2010, 16:45    Post subject:  

hi abushcrafter

Well, you can do it with the wildcard "*".. do you think I should make that the default action? And say, add an option for an exact match?

BTW, the string and word options look for anything close, just you need to know where to look with those options. Wink

Thanks for your interest

Cheers

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
abushcrafter


Joined: 30 Oct 2009
Posts: 1447
Location: England

PostPosted: Fri 09 Jul 2010, 18:21    Post subject:  

I know what I have done wrong. I thought it also searched file names as well as inside text files.
_________________
adobe flash is rubbish!
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/
Back to top
View user's profile Send private message Visit poster's website 
01micko


Joined: 11 Oct 2008
Posts: 7547
Location: qld

PostPosted: Sat 10 Jul 2010, 17:08    Post subject:  

Hey abushcrafter... do you think the 'help' is clear enough? My diction is poor at the best of times!

Cheers

_________________
Woof Mailing List | keep the faith Cool |
Back to top
View user's profile Send private message Visit poster's website 
abushcrafter


Joined: 30 Oct 2009
Posts: 1447
Location: England

PostPosted: Sat 10 Jul 2010, 17:32    Post subject:  

01micko wrote:
Hey abushcrafter... do you think the 'help' is clear enough? My diction is poor at the best of times!

Cheers
No it was me.
_________________
adobe flash is rubbish!
My Quote:"Humans are stupid, though some are clever but stupid." http://www.dependent.de/media/audio/mp3/System_Syn_Heres_to_You.zip http://www.systemsyn.com/
Back to top
View user's profile Send private message Visit poster's website 
gcmartin

Joined: 14 Oct 2005
Posts: 3631
Location: Earth

PostPosted: Wed 18 Aug 2010, 21:04    Post subject: SCLISS  

IFF I understand correctly, this is a search tool to "look" inside the files in the path for a particular word or phrase..

Is that correct?

Where I think there is confusion is as follows:
someone (noob like myself) could mistakenly assume that this tool could be used to list all files that have "text" in it filename.

If I understand correctly, this tool will open each file in a directory and look for a text/phase item within.

Is that correct? If so, maybe a simple statement that the tool cannot be used to list filenames which have 'text" in the filename.

Hope this helps.

_________________
Get ACTIVE Create Circles; Do those good things which benefit people's needs!
We are all related ... Its time to show that we know this!
3 Different Puppy Search Engine or use DogPile
Back to top
View user's profile Send private message 
Jasper


Joined: 25 Apr 2010
Posts: 1034
Location: England

PostPosted: Wed 18 Aug 2010, 21:52    Post subject:  

Hi,

I tried to use it without any success, but that is sure to be my lack of understanding and not a deficiency in the help.

I would very much appreciate a simple example (ideally using any actual directories and file(s) that come as standard with lupu 5.1) which I could copy and paste or type into my console to see some output.

Also, I don't have a middle mouse button and I find it tricky to simulate the paste process using the left and right buttons simultaneously; so I wonder is there, or could there be a shortcut or other action to paste to a terminal?

My regards
Back to top
View user's profile Send private message 
dinosoep

Joined: 18 Aug 2010
Posts: 29

PostPosted: Thu 19 Aug 2010, 15:09    Post subject:  

can come in handy, thanks
when my problem of not beeing able to install pets is fixed, I'll download it and try it out
Back to top
View user's profile Send private message 
Display posts from previous:   Sort by:   
Page 1 of 2 [19 Posts]   Goto page: 1, 2 Next
Post new topic   Reply to topic View previous topic :: View next topic
 Forum index » House Training » Users ( For the regulars )
Jump to:  

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group
[ Time: 0.0740s ][ Queries: 12 (0.0048s) ][ GZIP on ]