Sed or Awk for modify hour in a crontab AIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Sed or Awk for modify hour in a crontab AIX
# 1  
Old 02-01-2010
Sed or Awk for modify hour in a crontab AIX

Hi,

I want to modifiy the hour in the crontab AIX 5.3 for this line:

Input:
Code:
00 22 * * * /outillage/script_exploit/bin/SavOffline.ksh > /dev/null 2>&1

Output:
Code:
30 20 * * * /outillage/script_exploit/bin/SavOffline.ksh > /dev/null 2>&1

With the awk or sed function through a ssh -q <serveur> <cmd>

Thanks
# 2  
Old 02-01-2010
Code:
#!/usr/bin/bash
#modify cron tab file
ssh -q <serveur> <cmd>
cut -f1,2 -d" " /root/cronsample | paste -  /root/crontab  | awk -F" " '{print $1,$2,$5,$6,$7,$8 } '  > /tmp/tmp.txt
cp /tmp/tmp.txt /etc/crontab
rm /tmp/tmp.txt

sorry because i've alitlle experience but i tried to help you as i can
this script i test it in linux ubuntu you can change the path of files
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Sed, awk or another bash command to modify string with the content of another file

Hello everybody, I would like modify some strings using sed or another command line with the content file. For example: - {fqdn: "server-01" , ip: "server-01"} - {fqdn: "server-02" , ip: "server-02"} - {fqdn: "server-03" , ip: "server-03"} - {fqdn: "server-04" , ip: "server-04"} My... (4 Replies)
Discussion started by: dco
4 Replies

2. Shell Programming and Scripting

Using awk and sed to modify a create sql script

Hi, I have a file which contains the following data claim_src|clm_id,typ_id pat_src|pat_id prov_src|prov_id,clm_id,prov_name The first field is table name and second field is primary keys of the table Now I have three files which contain ddl of each table. clam_src.sql... (4 Replies)
Discussion started by: wahi80
4 Replies

3. Shell Programming and Scripting

Modify xml using sed or awk

Hi All, I want to modify(changing the status from "on" to "off" status of Stage-element value from the below xml file using sed or awk: File Name: global.xml <?xml version="1.0" encoding="UTF-8"?> <config> <widget> <name>HTTP-POOL</name> <attributes> ... (5 Replies)
Discussion started by: wamqemail2
5 Replies

4. UNIX for Dummies Questions & Answers

Modify hour crontab UNIX

Hello, I wish to modify the day of launch of a "batch" in the crontab on several servers with awk or sed. Can you help me ? Beforehand thank you 00 18 * * 1 /box/Pra/bin/systeme_reverse.ksh -s >/dev/null 2>&1 (7 Replies)
Discussion started by: khalidou13
7 Replies

5. Shell Programming and Scripting

Crontab error - bad hour

Hi All, While setting the crontab i am getting the below error, "/tmp/crontab.XXXXwKymEc" 156L, 15621C written crontab: installing new crontab "/tmp/crontab.XXXXwKymEc":74: bad hour Please help. Thanks (2 Replies)
Discussion started by: nag_sathi
2 Replies

6. Shell Programming and Scripting

E-mail based on crontab hour

I have a cron: 0 5,11,17,23 * * * /home/oracle/scripts/sysize.ksh This cron will trigger cat dbsz.txt | mail -s "$TODAY: PROD DB Size" $RECIPIENTS I don't want to get the e-mail notice 4 times a day. Can I have just one e-mail triggered at 11 AM? Please advise. Thank you (3 Replies)
Discussion started by: Daniel Gate
3 Replies

7. Shell Programming and Scripting

Modify the file with awk,sed or perl

Hi All, I need help from any of you.Would be so thankful for your help. I/P DDDD,1045,161,1557,429,1694,800,1911,1113,2460,1457,2917> 1609,3113,1869,3317,2732,3701,3727,4132,5857,5107> 9004,6496 DDDD,1125,157,1558,429,1694,800,1911,1117,2432,1444,2906>... (2 Replies)
Discussion started by: Indra2011
2 Replies

8. AIX

crontab 1 hour off from current time

This is a new one on me. We upgraded a system from AIX 5.3 TL 7 to 6.1 TL 7 yesterday. The app people notified us that their cron jobs weren't running at the right time. So I made a test cron entry and here's what I've found: # crontab -l * * * * * /usr/bin/date > /tmp/test.log 2>&1 # cat... (2 Replies)
Discussion started by: homeyjoe
2 Replies

9. Shell Programming and Scripting

Crontab for every minute or every hour

How to set crontab for every minute or every hour (1 Reply)
Discussion started by: kaushik02018
1 Replies

10. Shell Programming and Scripting

modify and use awk sed program

The following awk script creates a file b.dat. awk '{print substr($0,1,27),substr($2,index($2,"_")+1)," ",substr($0,49)}' a.dat > b.dat I need this script to be modified to also sum $3 values by distinct $1 and $2 fields. Current file W2_2009275 2 8 W2_2009275 2 7 W1_2009275 1... (3 Replies)
Discussion started by: mnnarendra
3 Replies
Login or Register to Ask a Question