![]() |
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 |
| help needed in using case statement | jisha | Shell Programming and Scripting | 0 | 01-16-2008 04:33 AM |
| It's stunning, powerful and elegant... so set the iphone free - Guardian Unlimited | iBot | UNIX and Linux RSS News | 0 | 11-11-2007 06:30 AM |
| conditional statement | lalelle | Shell Programming and Scripting | 8 | 08-21-2007 08:57 AM |
| quoting in conditional statement | 3Gmobile | Shell Programming and Scripting | 2 | 08-14-2006 03:14 AM |
| awk conditional statement | 3Gmobile | Shell Programming and Scripting | 10 | 08-09-2006 10:01 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Hi all,
I have a script which gets its input from a text file (file.txt) and processes each line within a loop. I have a counter which increases by one and I want something to happen every 7th, 14th, 21st, etc. line read. Currently the code looks and works perfectly like this: ------------------------------------------ count="1" while read WORKSTATION do if [ $count -eq 7 ] || [ $count -eq 14 ] || [ $count -eq 21 ] ||\ [ $count -eq 28 ] || [ $count -eq 35 ] ; then some code here .... ((count=count+1)) fi done < file.txt ; ------------------------------------------ However, it doesn't look beautiful and with that many conditional statements (I shortened it, it goes further than just 35) I'm, looking for a more elegant solution. I have tried this if [ $count -eq '[7,14,21,28,35]' ] ; then but it doesn't work... Does anyone know the correct syntax - or is this not possible? Many thanks in advance! Cheers, Tom |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|