10 More Discussions You Might Find Interesting
1. UNIX for Beginners Questions & Answers
hi
i have a file which contains some messages counters.
below is the snippet on the file.
17-05-29::22:36:21|message|231
17-05-29::22:36:31|message|222
17-05-29::22:36:41|message|213
17-05-30::22:36:51|message|221
17-05-30::22:37:01|message|227
17-05-30::22:37:11|message|207... (5 Replies)
Discussion started by: scriptor
5 Replies
2. Shell Programming and Scripting
I've got a file that I'm trying to grep through that looks like this:
alpha1
alpha2
alpha3
beta1
beta2
gamma5
gamma6
gamma7
gamma8
gamma9
and I want the output to only contain the line with the highest value for each, so the output I want is:
alpha3
beta2
gamma9
I also need... (11 Replies)
Discussion started by: tiberione
11 Replies
3. Shell Programming and Scripting
Hello,
I usually search extensively and have to date found what I've needed. However, this one's got me stumped. I need to create a variable as follow. The issue however is that upon execution, it freezes. $var1 isn't always present in usage.log and this is fine but I'd like it to continue with... (6 Replies)
Discussion started by: shadyuk
6 Replies
4. Shell Programming and Scripting
how can I use grep with a variable to find a value?
cat data.out
Hello World
grep "Hello World" data.out
Hello World ## Value found
I want to do something like this but can't seem to get it to work any
suggestions would be appreciated.
var="Hello World"
grep $var data.out (3 Replies)
Discussion started by: BeefStu
3 Replies
5. Shell Programming and Scripting
I've a script of the following form calling a simple sql that counts the no of rows as based on some conditions. I want the count returned by the sql to get assigned to the variable sql_ret_val1. However I'm finding that this var is always getting assigned a value of 0. I have verified by executing... (1 Reply)
Discussion started by: MxC
1 Replies
6. Shell Programming and Scripting
can i grep a variable
say i have a variable var=`hostname` and I want to make an if statement like
if grep "esp-ueh" $var;then......
how can i do this
I dont want to store this variable in a file and the grep it because my script will be used at the same time on multiple stations and then that... (9 Replies)
Discussion started by: lassimanji
9 Replies
7. Shell Programming and Scripting
Hi all,
I am trying to do a simple thing in my mind. However I am fairly new to bash. What I need to do is create a folder for each partition on each CD, and each partition has a unique name (with spaces in it, do not ask why, it is already done :confused: ) . All CD's will show up... (2 Replies)
Discussion started by: sgstuart
2 Replies
8. Shell Programming and Scripting
Hi, I can't get this script to work (returns 0, should return 3):
$ cat A.lst | \
while read LINE
do
echo "$LINE"
grep -c "$LINE" B.tmp
done> > > > >
Socket
0
$
but in contrast this one works fine (returns 3 as expected):
$ LINE=Socket
$ grep -c $LINE B.tmp
3
$ (5 Replies)
Discussion started by: ozvena
5 Replies
9. Shell Programming and Scripting
I am trying to strip all leading and trailing spaces of a shell variable using either awk or sed or any other utility, however unscuccessful and need your help.
echo $SH_VAR | command_line Syntax.
The SH_VAR contains embedded spaces which needs to be preserved. I need only for the leading and... (6 Replies)
Discussion started by: jerardfjay
6 Replies
10. Shell Programming and Scripting
Hi,
I'd like to grep a variable that I saved in the program.
Like
grep '0\$variable1' file1
Does someone know what's wrong with this command?
Thanks a lot! (2 Replies)
Discussion started by: whatisthis
2 Replies