Continue the loop if the value is not found


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Continue the loop if the value is not found
# 1  
Old 06-12-2015
Continue the loop if the value is not found

Dear Help,

Is it possible to continue the loop by going to the next available value, if the 'expected value' is not found. I have a list of values which might not get incremented by fixed value and hence the loop could break and the script could terminate.

Any suggestion is appreciated.

Thanks,
Satyendra
# 2  
Old 06-12-2015
I can interpret this request many different ways.

Please:
  1. Show us what you have done.
  2. Show us sample input.
  3. Show us the output you are trying to produce from that input.
  4. Give a clear English description of how your sample input should be transformed into the output you want.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Variable not found error in while loop

I am unable to use the value of a variable. while ] do LstFldDataPart =`head -n "$LstFldDataPartCntr" "${FeedFileDir}/${FeedFileBadRecs}" | tail -1 | tr -d '\n'` echo $LstFldDataPart JndLstFldDataPart="${JndLstFldDataPart}${LstFldDataPart}" LstFldDataPartCntr=... (3 Replies)
Discussion started by: TomG
3 Replies

2. Shell Programming and Scripting

while loop error. (command not found)

can any1 please tell me what is problem with following code: i=1; cat test| while read CMD; do Var$i=$CMD; or Var$i=$(echo $CMD) ; let i++ doneI keep getting error : line 4: Var1=sometext: command not found (2 Replies)
Discussion started by: kashif.live
2 Replies

3. Shell Programming and Scripting

For loop and file not found

Hi All, I have a simple script.sh file. It gives me " file.txt' for reading (no such file or directory)" Why can this happen? %ls ch1file.txt ch2file.txt ch3file.txt % chmod +x script.sh % bash % ./script.sh where script.sh is as follows for i in seq(3) do awk '{print $1}'... (1 Reply)
Discussion started by: senayasma
1 Replies

4. Shell Programming and Scripting

How to continue numbering after a regular expression has been found

Hello, I have a file starting with: fixedStep chrom=chrX start=1 step=1 0.930 0.955 0.972 0.985 0.993 0.995 0.994 0.990 0.984 0.971 0.942 0.944 0.971 fixedStep chrom=chrX start=200 step=1 0.987 (2 Replies)
Discussion started by: jpoldot
2 Replies

5. Shell Programming and Scripting

How to continue in the loop after trapping signal

hi all.... plz tel me how can i solve this....here's the situation (just a sample!!).. $ cat sigtrap #!/usr/bin/perl $SIG{'INT'} = 'ABORT'; sub ABORT { print "\nStop the loop?? (y/n) : "; chop($ch=<STDIN>); if ($ch =~ //) { ... (3 Replies)
Discussion started by: tprayush
3 Replies

6. Shell Programming and Scripting

Loop through between 2 found lines

Hi frnd , hv nice week ahead, in shell script i found 2 words as below 1 ) targ_found=`sed -n \`echo $line_no\`p sesslog.txt | grep -ic 'Targ Rowid'` 2 ) bracket_found=`sed -n \`echo $line_no\`p sesslog.txt | grep -wc ')'` now we got he line number of 2 words. now i want to... (1 Reply)
Discussion started by: Gopal_Engg
1 Replies

7. Shell Programming and Scripting

file not found error during loop

Hi, I have a strange problem and I'm sure its because I'm doing something stupid. When I loop through all of the files in a directory they cannot be found. Any help would be greatly appreciated. Thanks, -E $ touch a.txt $ touch b.txt $ ls a.txt b.txt $ for f in `ls` ; do... (3 Replies)
Discussion started by: earls
3 Replies

8. Shell Programming and Scripting

Loop through found files

Hi I am trying to write a script which will loop through all files that end in ".txt" and ask user if they want to delete the file or not #this print out all files dir=/root/etc/ find $dir -name "*.txt" output: 1.txt 2.txt etc but what i really want is 1.txt delete(Y/N): 2.txt ... (11 Replies)
Discussion started by: Calypso
11 Replies

9. Shell Programming and Scripting

Continue Script when File Found

Hello All, I am trying to write a script that will only continue executing my script if a file exits. I know the directory of the file, so its just a matter of seeing if the file exists yet. If the file has not yet been created, I want the script to wait 10 minutes (600 seconds) and try again.... (7 Replies)
Discussion started by: Jose Miguel
7 Replies

10. Shell Programming and Scripting

variable not found with loop?

I cannot seem to pass the value of the variable assigned in the "else" statment below to an "if" statement outside of the loop. When I debug using "set -x", I find that the value of "$A" is empty. Is there something I'm missing here? Code is below: do if ] then echo "Good Match"... (2 Replies)
Discussion started by: douknownam
2 Replies
Login or Register to Ask a Question