Sponsored Content
Top Forums Shell Programming and Scripting regex, awk, grep question "how to" Post 302723229 by rawbi01 on Monday 29th of October 2012 05:26:40 PM
Old 10-29-2012
Question regex, awk, grep question "how to"

I've been working on this for 2 days and I'm not getting far. It is time to turn to you guys.

With the data below, I am trying to create a file that looks like this: I'd like to use some form of egrep I think.

Code:
AY#box#P04prod_to_contingency s AY#cmd#P04dump_cont_db s AY#cmd#P04get_on_ice_job s AY#cmd#P04get_on_hold_jobs s AY#cmd#P04jobs_with_sched
or like this:
AY#cmd#P04load_db_into_shadow,s,AY#cmd#P04copy_cont_primary_ to_shadow

The Fields are all alpha. Field1 = Job, Field2 = cond_attr, Field3 = Con_Job
There is always one job but each job can have 0 to 10 cond_attr's, con jobs
The con_attr can = s or sucess, c or complete, d or done. In the example above the job starts with: insert_job: AY#cmd#P04copy_cont_primary_to_shadow
The condition starts 6 lines futher down: condition: s(AY#cmd#P04dump_cont_db)

Can anyone help??? I'll owe you big time.. Thanks


Code:
/* ----------------- AY#cmd#P04copy_cont_primary_to_shadow ----------------- */ 

insert_job: AY#cmd#P04copy_cont_primary_to_shadow job_type: c 
box_name: AY#box#P04prod_to_contingency
command: /export/apps/sched/local/contingency/bin/primary_cont_to_shadow.ksh
machine: vm_AY_P04_Shadow
owner: autosys
permission: gx
condition: s(AY#cmd#P04dump_cont_db) && s(AY#cmd#P04get_on_ice_jobs) && s(AY#cmd#P04get_on_hold_jobs) && s(AY#cmd#P04jobs_with_sched)
description: "Copy data dir from cont primary to shadow"
job_terminator: 1
std_out_file: >/export/apps/sched/local/contingency/logs/$AUTOSERV/$AUTO_JOB_NAME.out
std_err_file: >/export/apps/sched/local/contingency/logs/$AUTOSERV/$AUTO_JOB_NAME.err
alarm_if_fail: 1


/* ----------------- AY#cmd#P04load_db_into_shadow ----------------- */ 

insert_job: AY#cmd#P04load_db_into_shadow job_type: c 
box_name: AY#box#P04prod_to_contingency
command: /export/apps/sched/local/contingency/bin/load_shadow_cont_database.ksh
machine: vm_AY_P04_Prime
owner: autosys
permission: gx
condition: s(AY#cmd#P04copy_cont_primary_to_shadow)
description: "Load the cont primary DB into shadow"
job_terminator: 1
std_out_file: >/export/apps/sched/local/contingency/logs/$AUTOSERV/$AUTO_JOB_NAME.out
std_err_file: >/export/apps/sched/local/contingency/logs/$AUTOSERV/$AUTO_JOB_NAME.err
alarm_if_fail: 1


/* ----------------- AY#F8ADM#cmd#Weekly_Tactical_Dir_Bkup ----------------- */ 

insert_job: AY#F8ADM#cmd#Weekly_Tactical_Dir_Bkup job_type: c 
command: /export/apps/sched/log_archive/HOME_ACCTS/Tactical/Scripts/Tact-tar.ksh
machine: vm_AYF8-UNX_Admin
owner: autosys
permission: gx
date_conditions: 1
run_calendar: every_friday
start_times: "18:00"
description: "Bkup and Tar the Tactical directory every Friday"
term_run_time: 10
std_out_file: >/var/tmp/$AUTO_JOB_NAME.out
std_err_file: >/var/tmp/$AUTO_JOB_NAME.err
alarm_if_fail: 1


Last edited by zaxxon; 10-29-2012 at 06:28 PM.. Reason: code tags, see PM
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

correct syntax for using "grep regex filename" ?

I'm trying to grep a long ls by looking at the beginning of each filename for example: Many files begin with yong_ho_free_2005... Many files begin with yong_ho_2005... I can't just use "grep yong_ho" otherwise It'll display both files. So I'm trying to use a regex but my syntax is wrong. ... (2 Replies)
Discussion started by: yongho
2 Replies

2. UNIX for Dummies Questions & Answers

Explain the line "mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'`"

Hi Friends, Can any of you explain me about the below line of code? mn_code=`env|grep "..mn"|awk -F"=" '{print $2}'` Im not able to understand, what exactly it is doing :confused: Any help would be useful for me. Lokesha (4 Replies)
Discussion started by: Lokesha
4 Replies

3. Shell Programming and Scripting

ls -laR | grep "^-" | awk '{print $9}'| grep "$.txt"

Hi, I don't know hot to make this command work: ls -laR | grep "^-" | awk '{print $9}'| grep "$.txt" It should return the list of file .txt It's important to search .txt at the end of the line, becouse some file name have "txt" in their name but have other extensions (13 Replies)
Discussion started by: DNAx86
13 Replies

4. Shell Programming and Scripting

MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else

Hi Guys, I need to set the value of $7 to zero in case $7 is NULL. I've tried the below command but doesn't work. Any ideas. thanks guys. MEM=`ps v $PPID| grep -i db2 | grep -v grep| awk '{ if ( $7 ~ " " ) { print 0 } else { print $7}}' ` Harby. (4 Replies)
Discussion started by: hariza
4 Replies

5. Shell Programming and Scripting

cat $como_file | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g'

hi All, cat file_name | awk /^~/'{print $1","$2","$3","$4}' | sed -e 's/~//g' Can this be done by using sed or awk alone (4 Replies)
Discussion started by: harshakusam
4 Replies

6. Shell Programming and Scripting

perl: question about the regex "=~"

Hello all Is there a "not" reversal method for the =~ regex thingy in perl ? for example, in the snippet below, i have placed a ! in front of the =~ to "not it".. although it quite obviously doesn't work and is just me trying to get across the question in a way that somebody may understand :o... (2 Replies)
Discussion started by: rethink
2 Replies

7. Shell Programming and Scripting

ps -ef | grep "string1" "string2" " "string3"

Hi all, can any one suggest me the script to grep multiple strings from ps -ef pls correct the below script . its not working/ i want to print OK if all the below process are running in my solaris system. else i want to print NOT OK. bash-3.00$ ps -ef | grep blu lscpusr 48 42 ... (11 Replies)
Discussion started by: steve2216
11 Replies

8. Shell Programming and Scripting

awk command to replace ";" with "|" and ""|" at diferent places in line of file

Hi, I have line in input file as below: 3G_CENTRAL;INDONESIA_(M)_TELKOMSEL;SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL My expected output for line in the file must be : "1-Radon1-cMOC_deg"|"LDIndex"|"3G_CENTRAL|INDONESIA_(M)_TELKOMSEL"|LAST|"SPECIAL_WORLD_GRP_7_FA_2_TELKOMSEL" Can someone... (7 Replies)
Discussion started by: shis100
7 Replies

9. Shell Programming and Scripting

grep regex, match exact string which includes "/" anywhere on line.

I have a file that contains the 2 following lines (from /proc/mounts) /dev/sdc1 /mnt/backup2 xfs rw,relatime,attr2,noquota 0 0 /dev/sdb1 /mnt/backup xfs rw,relatime,attr2,noquota 0 0 I need to match the string in the second column exactly so that only one result is returned, e.g. > grep... (2 Replies)
Discussion started by: jelloir
2 Replies

10. Shell Programming and Scripting

how to use "cut" or "awk" or "sed" to remove a string

logs: "/home/abc/public_html/index.php" "/home/abc/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" "/home/xyz/public_html/index.php" how to use "cut" or "awk" or "sed" to get the following result: abc abc xyz xyz xyz (8 Replies)
Discussion started by: timmywong
8 Replies
TRACE-CMD-OPTIONS(1)													      TRACE-CMD-OPTIONS(1)

NAME
trace-cmd-options - list available options from trace-cmd plugins SYNOPSIS
trace-cmd options DESCRIPTION
The trace-cmd(1) options command will examine all the trace-cmd plugins that are used by trace-cmd report(1) and list them. SEE ALSO
trace-cmd(1), trace-cmd-record(1), trace-cmd-start(1), trace-cmd-stop(1), trace-cmd-extract(1), trace-cmd-reset(1), trace-cmd-split(1), trace-cmd-list(1), trace-cmd-listen(1) AUTHOR
Written by Steven Rostedt, <rostedt@goodmis.org[1]> RESOURCES
git://git.kernel.org/pub/scm/linux/kernel/git/rostedt/trace-cmd.git COPYING
Copyright (C) 2011 Red Hat, Inc. Free use of this software is granted under the terms of the GNU Public License (GPL). NOTES
1. rostedt@goodmis.org mailto:rostedt@goodmis.org 06/11/2014 TRACE-CMD-OPTIONS(1)
All times are GMT -4. The time now is 05:54 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy