The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Advanced & Expert Users
.
google unix.com



UNIX for Advanced & Expert Users Expert-to-Expert. Learn advanced UNIX, UNIX commands, Linux, Operating Systems, System Administration, Programming, Shell, Shell Scripts, Solaris, Linux, HP-UX, AIX, OS X, BSD.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Updating the input file prabhutkl UNIX for Dummies Questions & Answers 1 05-29-2009 05:27 AM
Updating the input file prabhutkl Shell Programming and Scripting 1 05-29-2009 05:03 AM
Reading specific contents from 1 input files and appending it to another input file sksahu Shell Programming and Scripting 5 01-14-2009 06:09 AM
awk updating one file with another, comparing, updating mecano Shell Programming and Scripting 11 09-14-2008 06:50 AM
Sed Help in Updating something only in one particular file. bisla.yogender Shell Programming and Scripting 4 03-24-2008 11:48 AM

 
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1 (permalink)  
Old 05-29-2009
prabhutkl prabhutkl is offline
Registered User
  
 

Join Date: Jun 2008
Posts: 9
Updating the input file

Hi Experts,

I have a requirement.

input_file.txt

Emp_no Emp_Name Salary
100 A 1000
101 B 2500
102 C 1500

I want to update the salary field of a record based on a condition(like emp_no=100).

Presently I am using a temperory file for updation.

Eg:
read the input_file
if $1=100
update salary + 1200
else if $1=101
update salary + 1000
...
...
output to a temp file.
move temp file input_file.txt
remove temp file
(I am passing the input_file as the first argument & emp_no as the second argument)
I am scheduling the script using crontab.Crotab entry is like this.

23 02 * * 1-5 /usr/bin/sh /isscrmetl/script_test/file_upd.sh input_file.txt 100
23 02 * * 1-5 /usr/bin/sh /isscrmetl/script_test/file_upd.sh input_file.txt 101
23 02 * * 1-5 /usr/bin/sh /isscrmetl/script_test/file_upd.sh input_file.txt 102

Since the script is executing parallely it is not giving the desired output.

Can we update the table without using a temperory file.

Thanks,
Prabhu
 

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 11:54 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0