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 > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
df, grep, wild card itik AIX 2 01-24-2008 10:41 AM
wild card & regular expressions eerener UNIX for Dummies Questions & Answers 1 10-01-2007 12:04 AM
Wild card in find perm braindrain Shell Programming and Scripting 1 04-12-2007 06:24 PM
How do I pass a wild card as an argument eja UNIX for Dummies Questions & Answers 2 03-28-2007 02:03 PM
ls and wild card - Should be simple! GNMIKE UNIX for Dummies Questions & Answers 2 10-13-2005 07:41 AM

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 05-17-2002
rooh rooh is offline
Registered User
  
 

Join Date: Jul 2001
Posts: 62
using if with wild card patterns

Hi,

Please help me.

Suppose I have a file which contains files like:
My file :/tmp/rooh_20020518.lst
it consists:
ASI00320225041925URD01
ASI00320225041925KER02
ASI00390228095244KER08
ASI00390228095244KER06
ASI00390228095244URD14 ASI00390228095244URD07
ASI00390228095244KER13

These files actually exist in a directory along with other files :/home/rooh

Now I want to move the files like ASI*URD* to /tmp/rooh1
and ASI*KER* to /tmp/rooh2

I am trying to do it like this but it doesn't work:
for file in `cat /tmp/rooh_20020518.lst`
do
{
if [ -f /home/rooh/$file ]; then
if [ "/home/rooh/$file" = ASI*KER* ]; then
mv /home/rooh/$file /tmp/rooh2
elif [ "/home/rooh/$file" = ASI*URD* ]; then
mv /home/rooh/$file /tmp/rooh1
else
echo " file ASI does not exist"
fi
else
echo " file does not exist in /home/rooh"
fi
}
done

But this doesn't work.
Please help and advice

Thanks.
Rooh
  #2 (permalink)  
Old 05-18-2002
Perderabo's Avatar
Perderabo Perderabo is offline Forum Staff  
Unix Daemon
  
 

Join Date: Aug 2001
Location: Ashburn, Virginia
Posts: 9,111
You don't say which shell you are using. If it's ksh or bash, try this:
if [[ /home/rooh/$file = ASI*KER* ]] ; then
Closed Thread

Bookmarks

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 03:13 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