The variable $EachLine2 is not quoted. If it contains a space character or nothing it effectively disappears.
Where $DATA_DIR/cells*.dat expands to more than one filename the grep is still syntactically correct even if $EachLine2 is blank or spaces in which case the first filename gets treated as a regular expression by grep !
To see what $DATA_DIR/cells*.dat expands to, try a plain echo on the variable.
My apologies haaru, when I gave you the grep line to quote I meant it to be on the code you posted originally.
I understand that other people helping you has probably led you down other routes now - but I'm positive if you quote the grep line as I showed you, on the code you originally posted, it will work.
My apologies haaru, when I gave you the grep line to quote I meant it to be on the code you posted originally.
I understand that other people helping you has probably led you down other routes now - but I'm positive if you quote the grep line as I showed you, on the code you originally posted, it will work.
No worries steviefordi!
I think that this is getting somewhere now..
feeding it 103 rows of data (sample below):
gave 572411 rows of results!! (sample below):
I noticed:
For the first 3 values fed we get correct results in the correct pattern
<<Input>> = <<Output>>
When the first empty row of data arrives, we get incorrect data for that result but we still get the correct output pattern.
For every result after that we get Incorrect data tottaly ignoring the pattern posting only the result.
The output of the program consisted only of exit status 0.
The loop successfuly iterated 103 times, did a wc -l on check.txt file that has the exit status, ( ) but I am led to believe that after the first empty row it was either:
Fed the whole list of input numbers for each iteration.
Grepped everything from the resultset since the input string was "".
I favor No.2
I think that I will get to the bottom of this, thanks to your help, by just changing the grep command format!
---------- Post updated at 05:50 PM ---------- Previous update was at 05:02 PM ----------
Quote:
Originally Posted by steviefordi
Ok another thing to try -
What is the exit status of the grep line when EachLine2 contains the empty string. I think that it is failing and causing your loop to exit.
Personally I would add three sets of quotes to the line as such:
Problem solved! Thanks everyone and especially steviefordi!!
I used the above plus a more demanding grep command ( grep "\"[A-Z]"$EachLine2"\"" ) to get the correct results
Hello,
I am looking for a specific situation in a text file. The conditions are,
> <CompoundName>
InChI=1S/C5H12NO2/c1-5(2)4-8-6(3)7/h5H,4H2,1-3H3/q+1
I am looking for cases where the line "> <CompoundName>" is followed by a line that contains the string "InChI=" without regard to... (5 Replies)
Dear All,
In a CSV file, say that a given column has been extracted. In that column, information is missing (i.e. blank lines appear). I would like to replace the blank lines by the last valid line (not blank) previously read.
For example, consider the extract below:
123
234
543
111... (7 Replies)
Below for loop not exiting. Can someone help?
JBOSS_INST_ARGS=01 02
if ; then
for i in $JBOSS_INST_ARGS; do
/u/jboss-6.1.0.Final/bin/jboss_init_wise$i.sh start;
done (8 Replies)
All,
I wrote the following section of code (which logically in PHP would of worked):
tmpPATH=${1}
tmpTAG=${2}
if
then
while read tmpTAG tmpPATH
do
fi
echo $tmpTAG
echo $tmpPATH
if
then
done < ./config.cfg
fi (4 Replies)
Hello all, I created the below script....and it seemed to be working fine. My problem is i want the script to ignore rest of the things if my condition is not met but do not exit....
#!/bin/ksh
###########################
###########################
# Set name of the listener, this... (2 Replies)
hi,
how to exit from "if" loop?actually i have mutliple "if" conditions, i have to exit from each "if" loop,if it is true...:confused:
Please suggest me... (3 Replies)
Hi Guys,
I have a file in which each set of records are separated by two blank line. I want to replace it with a single blank line.
Can you guys help me out?
Regards,
Magesh (9 Replies)
I am having trouble figuring this code
I want to grep a text from a file and if it match certain text it break out of the loop or it should continue searching for the text
Here is what I have written but it isn't working
while true
f=`grep 'END OF STATUS REPORT' filename`
do
if ... (9 Replies)
i wrote a while script as part of a huge program. this script, once picked, begins to output data to the person using it. pretty easy, as the person doesn't have to keep typing commands to get the output that the while loop automatically throws out.
now, the thing is, while this while-script... (3 Replies)