08-14-2005
grep from a script...
This is an extract from a script that i am trying to run.
for tim in "2005:00:" "2005:01:" "2005:02:" "2005:03:" "2005:04:" "2005:05:"; do
FormString="$tim"
echo "grep '$FormString' access.10Aug-1201AM"
count=`grep "$FormString" access.10Aug-1201AM | wc -l`
echo " Time : $tim Count : $count"
done
but whn i execute this i get an error
grep '2005:00:' access.10Aug-1201AM
grep: can't open access.10Aug-1201AM
0
.
.
but if i am executing this command manually
grep '2005:00:' access.10Aug-1201AM
i get a count
why is this not working whn executed thru the script??
Any inputs??
Thanks in advance..
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hi guys,
i was hoping you could help me out with the following
im designing a help site for my work colleagues and would like a little script which would do a grep to check if an application is running on unix
for example this is what i do on unix
ps -ef | grep mqm
and this tells me if... (4 Replies)
Discussion started by: drchris
4 Replies
2. Shell Programming and Scripting
Hi,
I am new to this - I have a unix command (below) that I would like to make automated. I would like the script to run the below command line but would like user input for '\' and '\' as these values will change depending on what i'm searching for. Is this possible? if so please help.
... (13 Replies)
Discussion started by: dnash
13 Replies
3. UNIX for Dummies Questions & Answers
Hi.
I am trying to extract the output of the first few lines of a continuos sh script.
The when i run it, i wont to grep the the first 20 lines of it for an entry and basically do a crtl z out of it or to that effect, and output the results to a text file.
I basically want to script... (5 Replies)
Discussion started by: k00061804
5 Replies
4. Shell Programming and Scripting
I need help in the following script. I want to grep the sql errors insert into the error table and exit the shell script if there is any error, otherwise keep running the scripts.
Here is my script
#!/bin/csh -f
source .orapass
set user = $USER
set pass = $PASS
cd /opt/data/scripts
echo... (2 Replies)
Discussion started by: allinshell99
2 Replies
5. Shell Programming and Scripting
Hi
i wrote script use it as watchdog ( i mean it check another program (pooya) whenever that was killed (closed or crashed) it run another script (pooya_start.sh) to start it,
this script work fine and do the job for me , i need help of an expert to tell me (exact command) how to change this... (8 Replies)
Discussion started by: pooyair
8 Replies
6. UNIX for Dummies Questions & Answers
Hello,
I have a command and would like to make that as a script. How do I do that?
my command is:
grep -Eo +\.+\.+\.+.
and i want to have that like grepscript.sh x.txt > IP.txt
Can somebody help me? (3 Replies)
Discussion started by: eightball
3 Replies
7. Shell Programming and Scripting
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)
Discussion started by: wtolentino
6 Replies
8. Shell Programming and Scripting
Hallo gentlemen,
i've a problem removing lines from txt file. To make it simple, here is an example:
TEXT1.TXT --- contents:
9.9.9.9 geek.net
1.1.1.1 geek.com
2.2.2.2 leet.net
TEXT2.TXT --- contents:
geek.com
coolbar.org
I simply do:
cat text1.txt | grep -f text2.txt >... (7 Replies)
Discussion started by: mirkocosta
7 Replies
9. Shell Programming and Scripting
Hi,
New to scripting and looking for some help.
I am trying to write a script that will search a specified directory for any new or modified files within the last 7 days and display the results. This will be ran daily and emailed?
Thanks (18 Replies)
Discussion started by: Con592
18 Replies
10. UNIX for Beginners Questions & Answers
Hi,
I found script which compare ciphers with openssl and return back all result in "YES" (for matching) and "NO" (for no match)
I want to result only "YES" part which can be achieved using grep but not sure how and where to place in below script"
Script:... (1 Reply)
Discussion started by: khuharshree
1 Replies
LEARN ABOUT DEBIAN
finddup
FINDDUP(1) Perl FINDDUP(1)
NAME
finddup - Find identical files and do something with them
SYNOPSIS
Usage:
finddup [options...]
--man the manpage
-h, --help
a short help
--version
the version (CVS) of the program
-n, --noaction
do just nothing, just print out (implies -v)
-v, --verbose
just what the name says
-q, --quiet
be quiet
-l, --link
link the identical files together
-o, --oldresult
Use the old output of this script
-i, --ignore-perms
Don't check that file owner and permissions match
-d, --dir
Define the dir to check (you may specify more than one)
DESCRIPTION
finddup search the working directory and all files below on the same partition for duplicate files.
finddup can optional hardlink such files to save space.
Files size 0 will not be reported or hardlinked as this might give problemes later.
This is a complete rewrite of the finddup in perl to handle several issues:
- Allow spaces and other characters in filenames
- be faster
- include nodup in same script
- Handle files that already have other hardlinks in the same tree
- Several improvements
If started as nodup or nodup.pl the script will act like started with options --link and --oldresult
COPYRIGHT
Copyright (c) 2005 by Klaus Ethgen. All rights reserved.
LICENSE
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MER-
CHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation,
Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
AUTHOR
Klaus Ethgen <Klaus@Ethgen.de<gt>
HISTORY
$Log: finddup,v $ Revision 2.3 2005/02/06 18:57:42 klaus * Make --oldresult faster by not calculating the md5sum again * Fix a but that
with --oldresult no links will be done cause the internal
datastructure * Do handle errors in open for md5sum calculation
Revision 2.2 2005/02/06 12:21:02 klaus Little but important bug in link routine.
Revision 2.1 2005/02/05 18:43:11 klaus Just cosmetic
Revision 2.0 2005/02/05 18:41:20 klaus Completely new version
Contributed User FINDDUP(1)