Hopefully the title is not too misleading but I'm hitting a stumbling block. I have a file that looks like this.
I loop through this file reach the cube id line where I strip out the 045 integer value and the idea is to then create a new line as follows
I also process the cube id line. So in the end, my file should look like this.
The code works fine for 99% of what I need to do. Where I am struggling is in passing the correct cube id. So instead of /tmp/045 I see my original declaration of $cubeid which is 000. Because it's doing a while loop, $cubeid will always be 000 for the first 10 or so lines before it reaches the cube id line but by then it seems too late.
It seems rather trivial but I have been at this for a while but no joy. any help appreciated as always.
Last edited by vgersh99; 10-20-2011 at 06:41 PM..
Reason: code tags, please!
Hi friends, :)
In a shell script i found the following if condition.
echo -n "Which version of $1 do you want to restore ('0' to quit)? : "
read desired
if ${desired:=1} -ge $index ] ; then
echo "$0: Restore canceled by user: index value too big." >&2
exit 1
fi
Can... (1 Reply)
I do have a situation where , i need to zip the log files in the directory when the file exceeds more than 10MB.
cd $ORACLE_HOME/network/log
find . -type f -name "listener_*.log" > listeners
Now i have all my *.log files listed in the listeners file
So now i need to find the size of each... (5 Replies)
Executed the following if conditions .. and got different results .
only (( )) gave correct o/p with all scenarios .
Can anybody please let me know what is the difference between and ] and ((condition)) when used with if condition.
And why each condition gave different result.
1.... (2 Replies)
hi,
I have some problems in my simple script about the redirect echo stdout command inside a condition. Why is the echo command inside the elif still execute in the else command
Here are my simple script
After check on the two diff output the echo stdout redirect is present in two diff... (3 Replies)
I have an for loop that reads the following file
cat param.cfg
val1:env1:opt1
val2:env2:opt2
val3:env3:opt3
val4:env4:opt4
.
.
The for loop extracts the each line of the file so that at any one point, the value of i is
val1:env1:opt1 etc...
I would like to extract each... (19 Replies)
HI
My doubt may be basic one but I need to get it clarified..
When i use "if" condition that checks for many AND, OR logical conditions
like
if ]; then
return 0
fi
Even the if condition fails it returns as zero.. Any clue..
But if i add else condition like
if ]; ... (2 Replies)
Please help me new to shell getting error while running below in shell script
#!/bin/bash
set -x
cd /abc/def/ghi
pwd
xyz1=ghi
if
then
FAILURE_TEMP="The ghi directory has not been properly defined for this server."
echo ${FAILURE_TEMP} | /bin/mailx -s "apps copy failed"... (4 Replies)
Hello,
I want to use if condition in an expression as below:
$ORACLE_HOME is a variable something like below
/oraprod04_01/app/oracle/product/10204
Now here it is product/10204 I want to check if $ORACLE_HOME has something which has a string like /product/10* then one statement should... (4 Replies)