05-29-2009
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
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
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
2. Shell Programming and Scripting
Hi guys,
I am new to AWK and unix scripting. Please see below my problem and let me know if anyone you can help.
I have 2 input files (example given below)
Input file 2 is a standard file (it will not change) and we have to get the name (second column after comma) from it and append it... (5 Replies)
Discussion started by: sksahu
5 Replies
3. UNIX for Advanced & Expert Users
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... (1 Reply)
Discussion started by: prabhutkl
1 Replies
4. Shell Programming and Scripting
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... (1 Reply)
Discussion started by: prabhutkl
1 Replies
5. Shell Programming and Scripting
All,
I am trying to figure out a script to run in windows that will allow me to match on First column in file1 to 8th Column in File2 then
Insert file1 column2 to file2 column4 then create a new file.
File1:
12345 Sam
12346 Bob
12347 Bill
File2:... (1 Reply)
Discussion started by: darkoth
1 Replies
6. Shell Programming and Scripting
Hello,
I'm trying to figure out how best to approach this script, and I have very little experience, so I could use all the help I can get. :wall:
I regularly need to delete files from many directories.
A file with the same name may exist any number of times in different subdirectories.... (3 Replies)
Discussion started by: *ShadowCat*
3 Replies
7. Shell Programming and Scripting
I can not seem to figure out how to update the attached match.txt column 2 using update.txt. However, only the text before the period in updat.txt appears in match.txt.
For example, in update.txt NM_001613.2 matches NM_001613 in match.txt, so is it possible to update the record in match.txt to... (8 Replies)
Discussion started by: cmccabe
8 Replies
8. Shell Programming and Scripting
Dear Friends,
I am looking for a shell script to merge input files into one file .. here is my idea:
1st paramter would be outfile file (all input files content)
read all input files and merge them to input param 1
ex: if I pass 6 file names to the script then 1st file name as output file... (4 Replies)
Discussion started by: hyd1234
4 Replies
9. Homework & Coursework Questions
Just started learning Unix and received my first assignment recently. We haven't learned many commands and honestly, I'm stumped. I'd like to receive assistance/guidance/hints.
1. The problem statement, all variables and given/known data:
How do I write a shell script that takes in a file or... (4 Replies)
Discussion started by: fozilla
4 Replies
10. UNIX for Beginners Questions & Answers
hi,
i have an csv(which is a month's log file containing userid and log in date ) file which has to be appended to another file say master.log.I need to compare the next month's log data to master.log file .In case, there is new log date for userid it has to get updated in master.log file or i... (2 Replies)
Discussion started by: preema
2 Replies
LEARN ABOUT OPENDARWIN
lipo
LIPO(1) General Commands Manual LIPO(1)
NAME
lipo - create or operate on fat files
SYNOPSIS
lipo [-info] [-detailed_info] [-arch arch_type input_file] ... [ input_file] ... [-create] [-thin arch_type] [-replace arch_type file-
name] ... [-remove arch_type] ... [-extract arch_type] ... [-extract_family arch_type] ... [-output output_file] [-segalign arch_type
value] ...
DESCRIPTION
The lipo command creates or operates on ``fat'' (multi-architecture) files. It only ever produces one output file, and never alters the
input file. The operations that lipo performs are: listing the architecture types in a fat file; creating a single fat file from one or
more input files; thinning out a single fat file to one specified architecture type; and extracting, replacing, and/or removing architec-
tures types from the input file to create a single new fat output file.
Only one option can be specified, with the exception of -arch, -output, and -segalign, which are used in combination with other options.
The input_file argument is required, and only the -create option allows more than one input_file to be specified. The -output flag must be
used, except with the -info and -detailed_info flags.
The arch_type arguments may be any of the supported architecture names listed in the man page arch(3)exceptforVAXandMips.
OPTIONS
-info Briefly list the architecture types in the input fat file (just the names of each architecture).
-detailed_info
Display a detailed list of the architecture types in the input fat file (all the the information in the fat header, for each archi-
tecture in the file).
-arch arch_type input_file
Tells lipo that input_file contains the specified architecture type. The -arch arch_type specification is unnecessary if input_file
is an object file, a fat file, or some other file whose architecture(s) lipo can figure out.
-output output_file
Specifies its argument to be the output file.
-create
Take the input files (or file) and create one fat output file from them.
-thin arch_type
Take one input file and create a thin output file with the specified arch_type.
-replace arch_type file_name
Take one fat input file; in the output file, replace the arch_type contents of the input file with the contents of the specified
file_name.
-remove arch_type
Take one fat input file and remove the arch_type from that fat file, placing the result in the output file.
-extract arch_type
Take one fat input file and copy the arch_type from that fat file into a fat output file containing only that architecture.
-extract_family arch_type
Take one fat input file and copy all of the arch_types for the family that arch_type is in from that fat file into an output file
containing only those architectures. The file will be thin if only one architecture is found or fat otherwise.
-segalign arch_type value
Set the segment alignment of the specified arch_type when creating a fat file containing that architecture. value is a hexadecimal
number that must be an integral power of 2. This is only needed when lipo can't figure out the alignment of an input file (cur-
rently not an object file), or when it guesses at the alignment too conservatively. The default for files unknown to lipo is 0
(2^0, or an alignment of one byte), and the default alignment for archives is 4 (2^2, or 4-byte alignment).
SEE ALSO
arch(3)
Apple Computer, Inc. October 23, 1997 LIPO(1)