![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Linux Shell Question: how to print the shell script name ? | meili100 | UNIX for Dummies Questions & Answers | 3 | 07-01-2008 01:55 PM |
| Shell script question | jbou1087 | Shell Programming and Scripting | 2 | 05-06-2008 02:01 AM |
| shell script question | tselvanin | Shell Programming and Scripting | 2 | 08-28-2007 09:53 PM |
| Simply shell script question | frustrated1 | Shell Programming and Scripting | 8 | 07-03-2005 02:22 AM |
| BASH shell script question | ewarmour | Shell Programming and Scripting | 3 | 05-24-2002 05:10 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
A shell script question
Hi,
I have a file say xmldir.conf. This is a flat file which contains the data in specific format not other then this. The format is /backup/surjya/mvfile,noeof /backup/surjya/mdbase,eof /backup/surjya/mdbaseso /backup/surjya/trial,hoeof /backup/surjya/test,eof The field before "," is directory names and field after "," is an attribute of the directory. I have written a shell script to list out the directory names from xmldir.conf file according to the attribute. Those names will be listed only if attribute is noeof or eof. If no attribute is there like 3rd row of the file then it is treated as also eof attribute. Now my program is #!/bin/sh conffile=xmldir.conf dir=`cut -d, -f1 xmldir.conf` echo $dir for dir1 in $dir do insertmode=`grep $dir1 $conffile | awk '{FS = ","} {print$2}'` echo $insertmode #echo $dir1 $insertmode if [ $insertmode = "eof" -o $insertmode = "" ] then echo "It is eof dirs" $dir1 else if [ $insertmode = "noeof" ] then echo " It is noeof dirs" $dir1 fi else echo " It is neither of these" fi done But it is not working. It fails when it is checked for rows without atribute. So please let me know how can I correct this. Thanks |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|