05-17-2002
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
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I am trying to cp files that have F0 as prefix in their name in path p1/p2 to path p3/p4
this command does not work - Why? (I am using HP/UX)
cp p1/p2/F0* p3/p4
thanks. (2 Replies)
Discussion started by: GNMIKE
2 Replies
2. UNIX for Dummies Questions & Answers
Hi,
I would like to pass a wild card as part of an argument. But when I do it the script views the wild card as text.
Example:
sFile=MG1A*
sort $sFile > $sFile.sorted
What I get is MG1A*.sorted
The problem is I am passed a series of files where the first few characters like "MG1A"... (2 Replies)
Discussion started by: eja
2 Replies
3. Shell Programming and Scripting
Hi,
Is there a way to use find command to list the directories for certain permissions. I know we can use find . -type d -perm nnn, where nnn is the permission number . However I wold like to know if I wanna search for wild card permissions i.e 75* / 7* / 55* , as i do not know the actual... (1 Reply)
Discussion started by: braindrain
1 Replies
4. UNIX for Dummies Questions & Answers
Hi, guys I have a question
what is wild card and regular expression, I think both of them same if not, please give me an example.
thanks (1 Reply)
Discussion started by: eerener
1 Replies
5. AIX
Hi,
I want to monitor my filesystem capacity and I want to df with grep wildcard for all 9*%.
Is this possible? I want to replaced all the existing complicated scripts I have in the system.
Thanks,
Itik (2 Replies)
Discussion started by: itik
2 Replies
6. Shell Programming and Scripting
Hi All,
I'm new to shell scripting. Please help me in achieving this
I am trying to a find regular expression that need to pick a file with begin with the below format and this code is called in xml file.
currently the script accepts:... (0 Replies)
Discussion started by: vasavi_cherku
0 Replies
7. Shell Programming and Scripting
Hi,
I am using RHEL5.
I have following if condition.
if
In the above condition, if the value of a contains word WARNING, it should match. i.e., WARNING_MESSAGE, CRITICAL WARNING, WARNING ALERT etc. it should match.
For b, alert error, ALERT ERROR, ERROR IMMEDIATE ACTION REQUIRED, etc... (2 Replies)
Discussion started by: user7509
2 Replies
8. Shell Programming and Scripting
Hi,
I am having a file (file1) having following contents
" xet B - All Divers/All Rivers - - ns - "
Now when i use
cat file1 | grep 'RF'
it doesn't returns anything.
But on using
cat file1 | grep 'RF*'
shows me... (6 Replies)
Discussion started by: sarbjit
6 Replies
9. Shell Programming and Scripting
Can somebody help me with the following syntax? I want to find all
files that end with *.arc
SUFFIX=".arc"
find /tmp -name "\*$SUFFIX" -print 2>/dev/null
---------- Post updated at 03:45 PM ---------- Previous update was at 03:41 PM ----------
got it thanks
-name... (0 Replies)
Discussion started by: BeefStu
0 Replies
10. Shell Programming and Scripting
I have dir structure like this :
/opt/oracle/product/abc/sqlplus/admin/
/opt/oracle/product/def/sqlplus/admin
/opt/oracle/product/ghi/sqlplus/admin
I am trying to use wildcard ( for dirs abc,def,ghi) ..something like this :
cp xyz.txt ... (1 Reply)
Discussion started by: talashil
1 Replies
LEARN ABOUT DEBIAN
ibdmchk
IBDMCHK(1) IB DATA MODEL PACKAGE IBDMCHK(1)
NAME
IBDM - Network Checker and Attributes Analyzer
SYNOPSYS
ibdmchk has two operation modes: design and verification.
DESIGN:
ibdmchk [-v][-h][-u][-a <roots file>] -t <topology file> -n <SM Node>
-p <SM Port> [-e] [-l <lmc>]
VERIFICATION:
ibdmchk [-v][-h][-r <roots file>] [-s <subnet file>] [-f <fdb file>]
[-l <lmc>]
DESIGN MODE DESCRIPTION
The Design mode is intended to be used before the cluster is built. It provides basic checks of the specified network as described by a
topology file. After simulating the SM LID assignment and routing algorithms it provides reports of the (H)CA to (H)CA paths depth his-
togram and credit deadlock potential in the resulting routing scheme.
ARGUMENTS
:
-t|--topo <topo file>
The topology file specifying the network. See man ibdm-topology-file
-n|--node <SM Node>
The name of the Subnet Manager node (syntax: <Topo-File-System>/U1)
-p|--port <SM Port>
The port number by which the SM nodes is attached to the fabric.
OPTIONS
-v|--verbose
Verbsoe mode
-h|--help
Provides this help message
-l|--lmc <lmc>
LMC value > 0 means assigning 2^lmc lids to each port.
-e|--enh
Use enhanced routing algorithm when LMC > 0 and report the resulting paths correlation (using same system/node) histogram
-u|--updn
Use up/down routing algorithm instead of OpenSM min-hop.
-r|--roots <roots file> A file with all the roots node names (one on each line).
VERIFICATION MODE DESCRIPTION
After the cluster is built and OpenSM is run (using flag -D 0x43) it reports the subnet and FDB tables into the files osm-subnet.lst,
osm.fdbs and osm.fdbs in /var/log/ (or subnet.lst, osm.fdbs and osm.mcfdbs into /tmp in older OpenSM versions). Based on these files the
utility checks all CA to CA connectivity. Further analysis for credit deadlock potential is performed and reported. In case of an LMC > 0
it reports histograms for how many systems and nodes are common between the different paths for the same port pairs.
ARGUMENTS
-l|--lmc <lmc>
The LMC value used while running OpenSM. Mandatory if not the default 0.
OPTIONS
-v|--verbose
Verbsoe mode
-h|--help
Provides this help message
-s|--subnet <file>
OpenSM subnet.lst file (default is /var/log/osm-subnet.lst or /tmp/subnet.lst)
-f|--fdb <file>
OpenSM dump of Ucast LFDB. Use -D 0x41 to generate it (default is /var/log/osm.fdbs or /tmp/osm.fdbs).
-m|--mcfdb <file>
OpenSM dump of Multicast LFDB. Use -D 0x41 to generate it (default is /var/log/osm.mcfdbs or /tmp/osm.mcfdbs).
-r|--roots <roots file>
A file holding all root nodes guids (one per line).
AUTHOR
Eitan Zahavi, Mellanox Technologies LTD, eitan@mellanox.co.il
IBDM 1.0 2008-06-16 IBDMCHK(1)