10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi All,
I want to run multiple sql queries and store the data in variable but i want to use sql command only once. Is there a way without running sql command twice and storing.Please advise.
Eg :
Select 'Query 1 output' from dual;
Select 'Query 2 output' from dual;
I want to... (3 Replies)
Discussion started by: Rokkesh
3 Replies
2. UNIX for Advanced & Expert Users
I have a below syntax its working fine...
var12=$(ps -ef | grep apache | awk '{print $2,$4}')
Im getting expected output as below:
printf "%b\n" "${VAR12}"
dell 123
dell 456
dell 457
Now I wrote a while loop.. the output of VAR12 should be passed as input parameters to while loop and results... (5 Replies)
Discussion started by: sam@sam
5 Replies
3. Shell Programming and Scripting
I'm working on a script in which gives certain details in its output depending on user-specified options. So, what I'd like to do is something like:
if
then
awkcmd='some_awk_command'
else
awkcmd='some_other_awk_command'
fi
Then, later in the script, we'd do something like:
... (5 Replies)
Discussion started by: treesloth
5 Replies
4. Shell Programming and Scripting
Hi,
My aim is to get the md5 hash of a file and store it in a variable.
var1="md5sum file1"
$var1
The above outputs fine but also contains the filename, so somthing like this 243ASsf25 file1
i just need to get the first part and put it into a variable.
var1="md5sum file1"... (5 Replies)
Discussion started by: JustALol
5 Replies
5. Shell Programming and Scripting
Hi all,
I am new to Linux/shell scripting having moderate knowledge.
In my script, I need to get execution time of a command (say 'ls') in mili seconds level. For this i tried using "time" command to retrieve the total execution time in milli seconds. But, the problem is that, how to save... (9 Replies)
Discussion started by: happening_linux
9 Replies
6. Shell Programming and Scripting
Hi,
I have a ftp script there I want to store the o/p of the below command:
sftp -b <batch file> user@password
cat <batch file>
get /remote/file/path/remote_file_name.csv*.gz /local/path
Now the problem is that when I fire this command. Then it gives o/p as:
File... (7 Replies)
Discussion started by: dips_ag
7 Replies
7. Shell Programming and Scripting
Hi all,
I m new to this forum.
I ma facing onei issue.
I have something like this:
length= wc -l < b2| awk '{print $1}'
where b2 is filename having detauls like:
cat b2
abc1
abc4
xyc3
sbdghf4
but when I do echo "$length" it displays nothing
Also I am using awk to overcome... (4 Replies)
Discussion started by: student2009
4 Replies
8. Shell Programming and Scripting
Hi Everyone,
I have a code which requires to be stored in different variables and I am achiving it like this.
HOST=`echo $RMP | cut -f2 -d:`
NAME=`echo $RMP | cut -f3 -d:`
DIR=`echo $RMP | cut -f4 -d:`
TYPE=`echo $RMP | cut -f5 -d:`
Is there any other way of storing value... (2 Replies)
Discussion started by: gehlnar
2 Replies
9. Programming
The following program takes two command line arguments.
I want the second argument (fileCount) to be stored/printed as a int value. I tried my best to typecast the char to int (check the printf statement at last) but is not working...the output is some junk value.
This program is in its... (3 Replies)
Discussion started by: frozensmilz
3 Replies
10. Shell Programming and Scripting
For whatever reason I cant seem to fix my syntax to do the following. I want to run a grep and count how many instances come up and store that number in a variable but I keep erroring out. Here's my code in bash:
number=grep blah file.txt | wc -l (1 Reply)
Discussion started by: eltinator
1 Replies