Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Updating a field in a File without creating temp file's Post 302320623 by prabhutkl on Thursday 28th of May 2009 12:27:18 PM
Old 05-28-2009
Updating a field in a File without creating temp file's

Hi Experts,

I have a requirement where i need to update the below items in file,

1. END TIME
2. PREV_STATUS

For the first time the PREV_status and end time of all job the job will be sysdate & NULL reply as below,

Session_name,Load Type,Frequency,Seesion End time,Prev_Status
s_d_m_crm_srr_team_sales,Full,Daily,28-MAY-2009 19:30:00,
s_d_m_crm_srr_team_mbrs_sales,Full,Daily,28-MAY-2009 18:30:00,
s_d_m_crm_srr_team_history_sales,Full,Daily,28-MAY-2009 17:30:00,
s_d_m_crm_srr_employees_sales,Full,Daily,28-MAY-2009 19:50:00,
s_d_m_crm_srr_jobs_sales,Full,Daily,28-MAY-2009 11:30:00,
s_d_m_crm_srr_employee_job_hist_sales,Full,Daily,28-MAY-2009 12:30:00,
s_d_m_crm_srr_x_tmbr_cust_sales,Full,Daily,28-MAY-2009 10:30:00,
s_d_m_crm_srr_x_team_tmbr_sales,Full,Daily,28-MAY-2009 11:30:00,
s_d_m_crm_srr_employees_specifics,Full,Daily,28-MAY-2009 09:30:00,
s_d_m_crm_srr_team_hierarchy_sales,Full,Daily,28-MAY-2009 01:30:00,

On successful completion of each job has to update the record's as below reply,

Session_name,Load Type,Frequency,Seesion End time,Prev_Status
s_d_m_crm_srr_team_sales,Full,Daily,29-MAY-2009 19:30:00,SUCCEEDED
s_d_m_crm_srr_team_mbrs_sales,Full,Daily,29-MAY-2009 18:30:00,FAILED
s_d_m_crm_srr_team_history_sales,Full,Daily,28-MAY-2009 17:30:00,
s_d_m_crm_srr_employees_sales,Full,Daily,29-MAY-2009 19:50:00,SUCCEEDED
s_d_m_crm_srr_jobs_sales,Full,Daily,29-MAY-2009 11:30:00,SUCCEEDED
s_d_m_crm_srr_employee_job_hist_sales,Full,Daily,29-MAY-2009 12:30:00,SUCCEEDED
s_d_m_crm_srr_x_tmbr_cust_sales,Full,Daily,29-MAY-2009 10:30:00,SUCCEEDED
s_d_m_crm_srr_x_team_tmbr_sales,Full,Daily,29-MAY-2009 11:30:00,SUCCEEDED
s_d_m_crm_srr_employees_specifics,Full,Daily,29-MAY-2009 09:30:00,SUCCEEDED
s_d_m_crm_srr_team_hierarchy_sales,Full,Daily,29-MAY-2009 01:30:00,SUCCEEDED

Since I am going to run the all the jobs parallely and there is high possiblity of updating the status and END TIME parallely in a file.

It has to update only one record in file without any temporary file to miss the latest updation.

It will be grateful if you could help me out to get sort out my requirement?

Thanks,
Prabhu
 

6 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Append to end of each line of file without a temp file.

Hello I am trying to append an incrimenting number to the end of each line I have it working with a temp file. But I want to do this without a temp file. a=1 cat "file" | while read LINE do echo "$LINE, $a" >> filewithnumbers a=`expr $a + 1` ... (4 Replies)
Discussion started by: rorey_breaker
4 Replies

2. Shell Programming and Scripting

awk updating one file with another, comparing, updating

Hello, I read and search through this wonderful forum and tried different approaches but it seems I lack some knowledge and neurones ^^ Here is what I'm trying to achieve : file1: test filea 3495; test fileb 4578; test filec 7689; test filey 9978; test filez 12300; file2: test filea... (11 Replies)
Discussion started by: mecano
11 Replies

3. Shell Programming and Scripting

find and replace a string in a file without the use of temp file

Hi - I am looking for a replacing a string in a in multiple *.sql files in directory with a new string without using a temporary file Normally I can use sed command as below for W in ls `FILE*.sql` do sed 's/OLD/NEW/g' $W > TEMPFILE.dat mv TEMPFILE.dat $W done But Here in my... (9 Replies)
Discussion started by: raghutapal
9 Replies

4. Shell Programming and Scripting

Lookup on large file based on a temp file

hello guys Please help me with the below issue I have two files one base file another lookupfile base file abc-001 bcd-001 cde-001 Lookupfile abc-001|11|12 abc-001|11|12 abc-001|11|12 (6 Replies)
Discussion started by: Pratik4891
6 Replies

5. Shell Programming and Scripting

Store the name of an extracted file to a temp file

What would be the best way to store the name of an extracted file from a tar to a text file? I want to extract one file from a tar and store the name of the extracted file to a temp file. tar -xvf tar_file.tar file_to_be_extracted (1 Reply)
Discussion started by: erin00
1 Replies

6. UNIX for Advanced & Expert Users

Creating the script for updating or replacing the existing http.conf file

Hi I need some help with a task, i am an absolute newbie to any form of shell scripting and request guidance. I have been building a proxy server using the apache mod proxy currently my solution is working , but i need to automate the process , suppose if any changes need to be made on... (0 Replies)
Discussion started by: satej
0 Replies
At(3pm) 						User Contributed Perl Documentation						   At(3pm)

NAME
Schedule::At - OS independent interface to the Unix 'at' command SYNOPSIS
require Schedule::At; Schedule::At::add(TIME => $string, COMMAND => $string [, TAG =>$string]); Schedule::At::add(TIME => $string, COMMAND => @array [, TAG =>$string]); Schedule::At::add(TIME => $string, FILE => $string) %jobs = Schedule::At::getJobs(); %jobs = Schedule::At::getJobs(JOBID => $string); %jobs = Schedule::At::getJobs(TAG => $string); Schedule::At::readJobs(JOBID => $string); Schedule::At::readJobs(TAG => $string); Schedule::At::remove(JOBID => $string); Schedule::At::remove(TAG => $string); DESCRIPTION
This modules provides an OS independent interface to 'at', the Unix command that allows you to execute commands at a specified time. Schedule::At::add Adds a new job to the at queue. You have to specify a TIME and a command to execute. The TIME has a common format: YYYYMMDDHHmm where YYYY is the year (4 digits), MM the month (01-12), DD is the day (01-31), HH the hour (00-23) and mm the minutes. The command is passed with the COMMAND or the FILE parameter. COMMAND can be used to pass the command as an string, or an array of commands, and FILE to read the commands from a file. The optional parameter TAG serves as an application specific way to identify a job or a set of jobs. Returns 0 on success or a value != 0 if an error occurred. Schedule::At::readJobs Read the job content identified by the JOBID or TAG parameters. Returns a hash of JOBID => $string where $string is the the job content. As the operating systems usually add a few environment settings, the content is longer than the command provided when adding the job. Schedule::At::remove Remove an at job. You identify the job to be deleted using the JOBID parameter (an opaque string returned by the getJobs subroutine). You can also specify a job or a set of jobs to delete with the TAG parameter, removing all the jobs that have the same tag (as specified with the add subroutine). Used with JOBID, returns 0 on success or a value != 0 if an error occurred. Used with TAG, returns a hash reference where the keys are the JOBID of the jobs found and the values indicate the success of the remove operation. Schedule::At::getJobs Called with no params returns a hash with all the current jobs or dies if an error has occurred. It's possible to specify the TAG or JOBID parameters so only matching jobs are returned. For each job the key is a JOBID (an OS dependent string that shouldn't be interpreted), and the value is a hash reference. This hash reference points to a hash with the keys: TIME An OS dependent string specifying the time to execute the command TAG The tag specified in the Schedule::At::add subroutine Configuration Variables o $Schedule::At::SHELL This variable can be used to specify shell for execution of the scheduled command. Can be useful for example when scheduling from CGI script and the account of the user under which httpd runs is locked by using '/bin/false' or similar as a shell. EXAMPLES
use Schedule::At; # 1 Schedule::At::add (TIME => '199801181530', COMMAND => 'ls', TAG => 'ScheduleAt'); # 2 @cmdlist = ("ls", "echo hello world"); Schedule::At::add (TIME => '199801181630', COMMAND => @cmdlist, TAG => 'ScheduleAt'); # 3 Schedule::At::add (TIME => '199801181730', COMMAND => 'df'); # This will remove #1 and #2 but no #3 Schedule::At::remove (TAG => 'ScheduleAt'); my %atJobs = Schedule::At::getJobs(); foreach my $job (values %atJobs) { print " ", $job->{JOBID}, " ", $job->{TIME}, ' ', ($job->{TAG} || ''), " "; } AUTHOR
Jose A. Rodriguez (jose AT rodriguez.jp) perl v5.14.2 2012-04-24 At(3pm)
All times are GMT -4. The time now is 01:13 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy