Embed commands into an expr command? (so I only store result)
Hi
Can I thank the advice I've received on here previously, working examples are helping me teach myself BASH fairly quickly and I've written some pretty complex scripts now (even if I do say so myself).
Anyhooo.....
I'm writing a script that handles lots of text files and does various calculations based on the count of those files and that sort of gumph.
At the moment for example I have sets of lines similar to this:-
I realise the sed is redundant however it's for the example.
I then use this value for just on calculation so the second VALUE= line is a bit of overkill really.
is there some way of coding something like
So that the line is all self contained and more readable and logical? Is there a general rule/syntax on how you can structure this?
Thanks in advance
Last edited by Bashingaway; 10-17-2010 at 09:34 AM..
Reason: added note
:)
Suppose,I have one table A. Table A have one column. Table A have 10 rows. I want this 10 rows store into shell script variable.
like
#!/bin/ksh
v_shell_var=Hi
here in call oracle , through loop How can I store table A's 10 rows into v_shell_var (Shell Script Array).
Regards,
Div (4 Replies)
Dear all,
I have a file having the following formats:
ThreadFail=Web1=1234
ThreadFail=Web2=2345
ThreadFail=Web3=12
ConnectionFail=DB1=11
ConnectionFail=DB2=22
The number of lines will be different from every time . How can I parse the file and store the result to an a array inside... (6 Replies)
Hi
I want to compare 2 files. The files have the same amount of rows and columns. So each line must be compare against the other and if one differs from the other, the result of both must be stored in a seperate file.
I am doing this in awk.
Here is my file1:
Blocks... (2 Replies)
Hi,
I'm trying to search a text file for a string: "energy(sigma->0)=". To do so, I executed the grep command, which returned many matches, for example:
energy without entropy = -112.16486170 energy(sigma->0) = -112.16520778
energy without entropy = -112.16488936 ... (5 Replies)
Hello;
When I try:
awk '/$(date "+%y\/%m\/%d")/,0'
It errors with:
awk: There is a regular expression error.
Invalid pattern.
Is there anyway to make this work ??
Thank you (2 Replies)
In a directory i have a file *output* whose contents are changing for every simulation.
zgrep "trace file is" *output* | zgrep g
o/p: trace file is Int_01.1352176388z4f56ec33.0.trace.gz
I want to extract "Int_01.1352176388z4f56ec33.0.trace.gz" from the above result into a variable.
i... (2 Replies)
I can not figure out how to capture the $filename variable store by the bash.
#!/bin/bash
# oldest folder stored as variable for analysis, version log created, and quality indicators matched to run
dir=/home/cmccabe/Desktop/NGS/test
find "$dir" -maxdepth 1 -mindepth 1 -type d -printf... (5 Replies)