Sponsored Content
Top Forums UNIX for Dummies Questions & Answers Updating a field in a File without creating temp file's Post 302321107 by prabhutkl on Saturday 30th of May 2009 06:47:14 AM
Old 05-30-2009
Updating a field in a File without creating temp file's

Hi vidyadhar85,

I tried with below script, but the problem when I schedule this script multple times to run at a same time to update different record in a file it is not working properly,

input_path='/isscrmetl/data001/script test/file_upd'
list_file=$1
sess_name=$2
if [ ! -f "$input_path"/"$list_file" ]
then
echo "List file not found"
else

IFS=" "
touch "$input_path"/$2_temp_file
cat "$input_path"/"$list_file" | while read session_name load_type freq end_time prev_stat
do

if [ "$session_name" = "$sess_name" ]
then
load_type='INCREMENTAL'
freq='DAILY'
#end_time=`date +%m%d%Y` date +/%m%d%y.%H%M%S'.
#end_time=`date +%d-%h-%Y %t`
end_time=`date`
prev_stat='SUCCEEDED'
fi
echo "$session_name $load_type $freq $end_time $prev_stat"
echo "$session_name $load_type $freq $end_time $prev_stat" >>"$input_path"/$2_temp_file
done
#echo "Temp File"
#cat "$input_path"/$2_temp_file
mv "$input_path"/$2_temp_file "$input_path"/"$list_file"

#rm -f "$input_path"/$1_temp_file
fi

exit 0;

Pls. assist me to get this done.

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
SESSION_NAME(3) 							 1							   SESSION_NAME(3)

session_name - Get and/or set the current session name

SYNOPSIS
string session_name ([string $name]) DESCRIPTION
session_name(3) returns the name of the current session. If $name is given, session_name(3) will update the session name and return the old session name. The session name is reset to the default value stored in session.name at request startup time. Thus, you need to call session_name(3) for every request (and before session_start(3) or session_register(3) are called). PARAMETERS
o $name - The session name references the name of the session, which is used in cookies and URLs (e.g. PHPSESSID). It should contain only alphanumeric characters; it should be short and descriptive (i.e. for users with enabled cookie warnings). If $name is specified, the name of the current session is changed to its value. Warning The session name can't consist of digits only, at least one letter must be present. Otherwise a new session id is generated every time. RETURN VALUES
Returns the name of the current session. If $name is given and function updates the session name, name of the old session is returned. EXAMPLES
Example #1 session_name(3) example <?php /* set the session name to WebsiteID */ $previous_name = session_name("WebsiteID"); echo "The previous session name was $previous_name<br />"; ?> SEE ALSO
The session.name configuration directive . PHP Documentation Group SESSION_NAME(3)
All times are GMT -4. The time now is 04:00 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy