When you use strict, all of your code needs to be strict. It's a hassle at first but it's useful when you start getting useful warnings when the code doesn't do what you expect. If your code is not strict, tackle that later. But adopt it in the next script you write. It's good for you.
The last will quit the foreach loop on the first blank or empty line. If you have empty lines in the patterns file, you probably mean "next", not "last".
If you have the same pattern multiple times in the pattern file, you will get multiple prints of the count of matches. I was under the impression that you were getting 1 login 2 login 3 login but now I see that you have 3 login 3 login 3 login, so it's simply reporting the same pattern multiple times. Welp, you can use a hash to prevent that, too.
Last edited by era; 04-22-2008 at 05:55 PM..
Reason: Optimize so $handled goes before grep
Hi,
I have a landing area where some files keep on coming after irregular intervals of time. From this landing area, I need to move files to another directory for processing. For this, I am using a for loop to find certain kinds of files in the landing area.
Now my question is, suppose I start... (6 Replies)
ls displays files in tabbed output. Say a directory contains 3 files. ls will list all 3 in one line. So, I expect ls | wc -l to give 1, but it counts the nr of files and gives 3.
Can someone explain how this works? (3 Replies)
pls explain me how this works....
DECODE (SUBSTR (field, 1, 1),'''', '''''' || field || '''','''' || field || '''')
here field is a column in an oracle table.... (7 Replies)
When I try to execute script, I get message:
>aa.pl
zsh: command not found: aa.pl
but
>./aa.pl
works OK.
What to change in environment to force the former way to work?
Thank you,
Alex Z (4 Replies)
Hi,
I am curious about this script , how it is running ..?
#!/bin/sh
echo "OK, starting now..."
ftp remotehost <<EOF
When I run , it is asking
OK, starting now...
Password:Name (remotehost):
SHould I enter only password ?
and explain me how it works..
thanks in advance.. (3 Replies)
I have a program............
#include<stdio.h>
#include<unistd.h>
main()
{
if(fork == 0)
{
printf("Hi every body:p!!!!!!!!!!");
}
}
This program works with out any error. here fork is not a system call. It just act as a variable.But how it works without declaring it? What data type it... (19 Replies)
Hi,
Could you please suggest a tool that connects like WINSCP/Putty and allows me to search a remote Unix directory for a certain text pattern (grep) ?
Regards,
Bhanja. (1 Reply)
i have this line of code that looks for the same file if it is currently running and returns the count.
`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh | grep -v grep | wc -l`
basically it is assigned to a variable
ISRUNNING=`ps -eaf -o args | grep -i sfs_pcard_load_file.ksh |... (6 Replies)
Hi,
On linux i have the below command working fine.
grep -o '<name>.*</name>' deploy.tmp | sed 's/\(<name>\|<\/name>\)//g' deploy.tmp
But the same is failing on Solaris
uname -a
SunOS mymac 5.10 Generic_150400-23 sun4v sparc sun4v
Can you tell me how can i get it work on Solaris ?... (6 Replies)
Hi,
I'm trying to make a grep to see if exists occurrences with a sentence like these:
grep -qi "message" file0 | grep -i $date | grep -vi "exception"
echo $?
1
If I execute without -q modifier I can find occurrences.
Someone could help me please?
Thanks and sorry for my English! (1 Reply)