Search script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Search script
# 8  
Old 02-03-2006
use 'nawk' instead old 'awk'.
# 9  
Old 02-03-2006
Using nawk I'm getting....

% find_script days tu
nawk: illegal primary in regular expression * ----------------- cir_softbook_sun ----------------- * at ----------------- cir_softbook_sun ----------------- *
source line number 3
context is
/* ----------------- cir_softbook_sun ----------------- >>> */ <<<
%
# 10  
Old 02-03-2006
sorry, don't have time to debug it now - you'll have to wait for aigles [or others] to respond.

Last edited by vgersh99; 02-03-2006 at 11:07 AM..
# 11  
Old 02-03-2006
Not a problem

Thanks for the reply though. I'll try and muddle through it. Guess I better take some time to learn nawk though..... ;-)
# 12  
Old 02-04-2006
Having no luck

I can't figure out what's wrong with the script. Would appreciate if someone could take a look. I'm obviously not seeing something.

Thanks Smilie
# 13  
Old 02-04-2006
Code:
# cat temp.awk
BEGIN {
FS = ":";
Before_Pattern = ".*" Before ".*";
After_Pattern = ":.*" After ".*";
}

/^BEGINJOB/,/^ENDJOB/ {
Memo[++Line_Count] = $0;
if ($1 ~ Before_Pattern) debug "Before match";
if ($1 ~ After_Pattern) debug "After match";
if ($1 ~ Before_Pattern && $0 ~ After_Pattern)
Print_Datas = 1;
}

/^ENDJOB/ {
if (Print_Datas) {
for (i=1; i<=Line_Count; i++)
print Memo[i];
}
Line_Count = 0;
Print_Datas = 0;
}

Code:
# nawk -f temp.awk -v Before="days" -v After="tu" file
BEGINJOB---------------------------
insert_job: cir_cdtsm01i job_type: c
command: /apps/usr/circ/bin/cdtsm01i.cmd
days_of_week: tu,we,th,fr,sa
start_times: "04:00"
description: "Templated Solo Mail - aoets20b.tx to aoets20b_txt"
ENDJOB

Solaris 8,9,10 all give the same result.
# 14  
Old 02-04-2006
That did it!!!!

Thank you sooooo much reborg.

Now, I will really learn nawk - for sure. Smilie
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Timebased search script

Hi there first of all, sry for my bad english and possible mistakes .-) I write scripts for my server to get my live easier. So my next one will be a script, where I can find special files in a folder. I put with a script of mine files in a folder on the server with following name... (5 Replies)
Discussion started by: bigsanch
5 Replies

2. UNIX for Dummies Questions & Answers

Help with ip search script

Hi Obviously first time poster here. I have been set the task of creating a network diagram for each of our clients in the business i work for. After identifying ip adresses of firewalls name servers and the like im got to the point where i found it impracticle to go through 254 ip address and... (6 Replies)
Discussion started by: jeked
6 Replies

3. Shell Programming and Scripting

Please help in creating search script

Hi all, Hope everyone is doing fine. I need a help in creating search script. I have file which contains job names and job recs. I need to select specific job name and next line which is job rec job (BLREEXTT) { Record B${cycle}${month}${year}000075; follows BLCYRRTCHKT; ... (5 Replies)
Discussion started by: taksistalo
5 Replies

4. Shell Programming and Scripting

Search and Copy Script

Dear All, I would like to create a Unix script which basically searches for files which are more than 2 days old and copy only the new files to the destination. What i mean is if the destination may have most of the files, it may not have only last 2 to 3 days file. I am able to create the... (6 Replies)
Discussion started by: rrb2009
6 Replies

5. Shell Programming and Scripting

Log Search Script

Hi, I am trying to write a script to search a log- IPaddress being the search criteria, I would ideally like the script to ask the ipaddress Enter IP address - 244.258.27.225 And the ideal result would be for the script to get all the entries in the log file for a particular IP address,... (3 Replies)
Discussion started by: fuzion.hyd
3 Replies

6. Shell Programming and Scripting

Small Search script

I need to write a small shell script which does the following : I have a file : root/var/log/ocmp/ocmpclient.log This is a log file which is continuosly getting updated . I have to keep looking into this file all the time. I have to look for four keywords, "File Detected", File Sending",... (2 Replies)
Discussion started by: appu1987
2 Replies

7. Shell Programming and Scripting

script to search a file

hi all i have a requirement to write a script which will serach a file in a particuar location for 3 hours from the time when the script is run.if during this period the file arrives in a particular location then this will transmit the file to a other server.please help me writing the script which... (1 Reply)
Discussion started by: dr46014
1 Replies

8. UNIX for Advanced & Expert Users

Help with search script

HI all, I am trying to find files that have .cc3 file extenstion folder using this script below, but this fails as there are files in the folder and i get a message saying i have no files. Please anyone reveiw and let me know if i am missing anything.I am working on this from two days and i... (9 Replies)
Discussion started by: bsandeep_80
9 Replies

9. Shell Programming and Scripting

Search File Script

Nice forum for noobs like me to UNIX. With that said, I need assistance. I am trying to make a script to search files for a specific date and string within the file. Then I need the script to move the file that have the specific date and string to a directory. In the interim I have been manually... (7 Replies)
Discussion started by: I4ce
7 Replies

10. Shell Programming and Scripting

script to search all the directories

Hi there, Is there any command or script to search all the directories for duplicated files? Thanks, Abrahim (3 Replies)
Discussion started by: abk
3 Replies
Login or Register to Ask a Question