The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Korn Shell Script to find out error in logfile jithu Shell Programming and Scripting 2 04-24-2008 02:12 PM
need a quick basic shell script help eb222 Shell Programming and Scripting 6 11-22-2007 09:00 AM
find and FTP multiple files in Korn Shell lambjam UNIX for Dummies Questions & Answers 2 08-13-2007 10:50 PM
how to convert from korn shell to normal shell with this code? forevercalz Shell Programming and Scripting 21 11-23-2005 02:18 AM
Find -name "*.txt" in Korn Shell Script jwperry Shell Programming and Scripting 3 07-19-2002 12:51 PM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-29-2001
Freakytah Freakytah is offline
Registered User
  
 

Join Date: Nov 2001
Posts: 6
Need quick help with basic FIND in korn shell

I gotta make a script to find files, not quite sure whats wrong...

filename is search

i run it

search ass* $HOME
ass* is the filename

and in my script i have...

find $2 -name $1 -print

but it never works, anyone know what i gotta fix?

and does anyone know the difference bettwen regular expressions and file expansion char's when it comes to seraching?
i know reg exp is but not expan.
thanks, steve
  #2 (permalink)  
Old 11-29-2001
vincew vincew is offline
Registered User
  
 

Join Date: Nov 2001
Location: Australia
Posts: 6
Here's a possible solution

Using your example
Input: search ass\* $HOME

Script: find $2 -name "$1" -print

Hope it helps.
  #3 (permalink)  
Old 11-29-2001
Freakytah Freakytah is offline
Registered User
  
 

Join Date: Nov 2001
Posts: 6
I still get:
Usage: find Path-List [Expression-List]
  #4 (permalink)  
Old 11-30-2001
MizzGail's Avatar
MizzGail MizzGail is offline
Registered User
  
 

Join Date: Sep 2001
Location: Syracuse, NY
Posts: 164
Lightbulb

I work in digital unix. If you are searching for a wild card it must be in quotes. Your command line mightneed to be:

find $HOME -name "ass*" -print

Also try
cd $HOME
ls -l | grep $2
  #5 (permalink)  
Old 11-30-2001
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
I think that everyon is trying too hard.

find /home -name "ass*" -print

this will search recursively through all home dirs under /home, change this to match your home directory.

Here is a better way.

If you only want to find certain users from one group. Do this.


grep UID /etc/passwd | awk -F: '{ print $1}' > /tmp/users.id
HOME=`/tmp/users.id`
for name in $HOME
do
find ~$HOME -name "ass*" -print
done

Where the UID is the group that you want to search their home directory.
  #6 (permalink)  
Old 11-30-2001
Freakytah Freakytah is offline
Registered User
  
 

Join Date: Nov 2001
Posts: 6
You guys are going off topic, lol

sorry, im making a script for school that runs like this
file is called search


search [filename] [top dir]

and in my code i have
find $2 -name "$1" -print

but thats not working, am i supposed to declare some variable or something to get this to work?

it just gives that error i posted above, something about USage:

thanks, steve
  #7 (permalink)  
Old 11-30-2001
Kelam_Magnus's Avatar
Kelam_Magnus Kelam_Magnus is offline Forum Advisor  
Registered User
  
 

Join Date: Aug 2001
Location: DFW McKinney, TX,
Posts: 1,069
This site does have a policy about posting homework. They usually frown on it.

So, if you post in the future, try to make it a "real world" question.

Thanks
Closed Thread

Bookmarks

Tags
regex, regular expressions

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 10:05 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0