10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
i am having some bash script which must use first sentence of the file. For example i have file which content is:
test 213
So I must use word test into my bash script, and put it into variable.
I am using a one variable named value
value=$(</home/rusher/test.txt)
so instead using test.txt... (1 Reply)
Discussion started by: tomislav91
1 Replies
2. Shell Programming and Scripting
Hi All,
I have a an array, in which i need to loop through all the variable and check each variable individually for a pattern.
For ex
#!/bin/ksh
set -A FileNames $(</Temp/AllNames)
echo "Total array elements :" ${#FileNames
}
for i in ${FileNames}
do
# if the "${i} | grep Last"... (3 Replies)
Discussion started by: baranisachin
3 Replies
3. Shell Programming and Scripting
Dear users,
I googled for a while, but i have got a lot of different answers regarding a simple unix command.
lets say there are a lot of files in a directory.
How can i list the files in a directory whose file types is "text"?
Thank you in advance (4 Replies)
Discussion started by: kevincobain2000
4 Replies
4. Shell Programming and Scripting
Hi,
Let say I have these 3 files (state, list and myscript). I want to be able get the sample output like below when I run myscript. Any one know how to fix the code? TIA.
~~~~~~~~~~~~~~~
> cat /home/state
CA
> cat /home/list
CA 100 50 20
AUS 120 61 10
> cat myscript... (6 Replies)
Discussion started by: joker_789us
6 Replies
5. Shell Programming and Scripting
I'm trying to take the output of an environment that has multiple strings
ex.
# echo $SSH_CLIENT
192.168.1.1 57039 22
I need that IP... so I can set it to another environment.
Thank you (3 Replies)
Discussion started by: adelsin
3 Replies
6. Shell Programming and Scripting
Hi All,
I am getting the output for the following command when i run it on the unix console.
---------------------------
grep `whoami` /etc/passwd | awk '{print ($1);}' | cut -d ":" -f3
----------------------------
But i made it into a script and tried to print the variable, its... (5 Replies)
Discussion started by: meheretoknow
5 Replies
7. Shell Programming and Scripting
i want to redirect the grep output into the variable
but i am not able to get it
i tried
veri=`grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1`
vari=$(grep -i $1 "${logdir}"* | grep -i adding | grep -iv equation | tail -1 | cut -d ':' -f 1)
BUT NOT... (1 Reply)
Discussion started by: mail2sant
1 Replies
8. AIX
Hi everybody
I looking the put the result of a commane to a Variable
i explain
here is my command:
FJTS_UK:root:common@ukaix3:/> cat sortie | grep "^"| awk '{ print $1}'
15
FJTS_UK:root:common@ukaix3:/>
sortie is a texte file
I want to put the result of commande in a... (1 Reply)
Discussion started by: kykyboss
1 Replies
9. UNIX for Dummies Questions & Answers
Hi,
How do I store following command output:
export RESULT=`date` &
It works when I do :
export RESULT=`date`
But what I need is when command put it background, I also need that output going to RESULT variable.
Is there any way ?
Thanks
Sanjay (1 Reply)
Discussion started by: sanjay92
1 Replies
10. UNIX for Dummies Questions & Answers
Hi,
I have an expression using grep and nawk that captures the ID number of a given Unix process. It gets printed to screen but I don't know how to declare a variable to this returned value!
For example,
ps -ef|grep $project | grep -v grep | nawk '{print $2}'
This returns my number. How... (2 Replies)
Discussion started by: babariba
2 Replies