Sponsored Content
Full Discussion: file update
Top Forums Shell Programming and Scripting file update Post 80748 by ssk on Thursday 11th of August 2005 09:10:46 AM
Old 08-11-2005
Bug update ??

You want to update a file means what you exactly want.

Do you want to change the timestamp of the file or contents from the file ?
if contents then obviously us vi editor and make changes.
if you want to change timestamp then use touch command.
check man touch for the same.
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

update a file with values from other file in shell bash

Hello I need to write a shell script to update properties between files. I have 2 files as follow: file1 urlWebserviceCheckAddress^=McoConfigGlobal.commonGLOBALUrlWebservice file 2 urlWebserviceCheckAddress=http://localhost:8080/tags Both files containt the same properties... (1 Reply)
Discussion started by: teodora
1 Replies

2. Shell Programming and Scripting

how to update a file

-Hi, I have several hundred files, which contain the following pattern: /bb/bin/msga/mm 80& I need to change the above pattern to be /bb/bin/mm 80& I there the command I can use to do that. Thanks a lot (3 Replies)
Discussion started by: aoussenko
3 Replies

3. Shell Programming and Scripting

rsync - update file on backup when file renamed on source

hi all, Please help me with rsync. I configured rsync to preserve timestamps using the -a option. When i renamed fileA to fileB on source machine I have to copies at the backup server. The aim is to keep the most recent file. fileA & fileB has same contents. When i renamed fileB to... (2 Replies)
Discussion started by: coolatt
2 Replies

4. Programming

MYSQL - trigger update on record insert or update

Right I have a MYSQL database with table1 with 3 columns, colA, colB and colC. I want to combine the data in the 3 columns into a 4th column names col_comb. Here's the SQL command that works: UPDATE table1 SET `col_comb` = CONCAT( `colA` , ' - ', `colB` , ', ', `colC` ); So now I want this... (5 Replies)
Discussion started by: barrydocks
5 Replies

5. Shell Programming and Scripting

Update file

Gents Please can you help. file1 43067.00 49301.00 314999999 43067.00 49157.00 313888888 43065.00 49157.00 313777777 43063.00 ... (5 Replies)
Discussion started by: jiam912
5 Replies

6. Shell Programming and Scripting

Perl to update field in file based of match to another file

In the perl below I am trying to set/update the value of $14 (last field) in file2, using the matching NM_ in $12 or $9 in file2 with the NM_ in $2 of file1. The lengths of $9 and $12 can be variable but what is consistent is the start pattern will always be NM_ and the end pattern is always ;... (4 Replies)
Discussion started by: cmccabe
4 Replies

7. Shell Programming and Scripting

awk to update file with sum of matching fields in another file

In the awk below I am trying to add a penalty to a score to each matching $1 in file2 based on the sum of $3+$4 (variable TL) from file1. Then the $4 value in file1 is divided by TL and multiplied by 100 (this valvue is variable S). Finally, $2 in file2 - S gives the updated $2 result in file2.... (2 Replies)
Discussion started by: cmccabe
2 Replies

8. Shell Programming and Scripting

Move file from one directory and update the list file once moved.

Dears, I have a listfile contains list of files path. i need to read the line of the listfile mv the file to other directory and update the listfile by deleting the lines of the listfile. #!/bin/bash target=/fstest/INVESTIG/Sadiq/TEST_ARCH while read -r line || ]; do mv $line... (19 Replies)
Discussion started by: sadique.manzar
19 Replies

9. UNIX for Beginners Questions & Answers

awk to update file with partial matching line in another file and append text

In the awk below I am trying to cp and paste each matching line in f2 to $3 in f1 if $2 of f1 is in the line in f2 somewhere. There will always be a match (usually more then 1) and my actual data is much larger (several hundreds of lines) in both f1 and f2. When the line in f2 is pasted to $3 in... (4 Replies)
Discussion started by: cmccabe
4 Replies
touch(1)							   User Commands							  touch(1)

NAME
touch, settime - change file access and modification times SYNOPSIS
touch [-acm] [-r ref_file | -t time] file... touch [-acm] [date_time] file... settime [-f ref_file] [date_time] file... DESCRIPTION
The touch utility sets the access and modification times of each file. The file operand is created if it does not already exist. The time used can be specified by -t time, by the corresponding time fields of the file referenced by -r ref_file, or by the date_time op- erand. If none of these are specified, touch uses the current time (the value returned by the time(2) function). If neither the -a nor -m options are specified, touch updates both the modification and access times. A user with write access to a file, but who is not the owner of the file or a super-user, can change the modification and access times of that file only to the current time. Attempts to set a specific time with touch will result in an error. The settime utility is equivalent to touch -c [date_time] file. OPTIONS
The following options are supported in the touch and settime utilities: touch The following options are supported for the touch utility: -a Changes the access time of file. Does not change the modification time unless -m is also specified. -c Does not create a specified file if it does not exist. Does not write any diagnostic messages concerning this condition. -m Changes the modification time of file. Does not change the access time unless -a is also specified. -r ref_file Uses the corresponding times of the file named by ref_file instead of the current time. -t time Uses the specified time instead of the current time. time will be a decimal number of the form: [[CC]YY]MMDDhhmm[.SS] where each two digits represent the following: MM The month of the year [01-12]. DD The day of the month [01-31]. hh The hour of the day [00-23]. mm The minute of the hour [00-59]. CC The first two digits of the year. YY The second two digits of the year. SS The second of the minute [00-61]. Both CC and YY are optional. If neither is given, the current year will be assumed. If YY is specified, but CC is not, CC will be derived as follows: +-----------------------------------------------------------+ | If YY is: CC becomes: | +-----------------------------------------------------------+ |69-99 19 | |00-38 20 | |39-68 ERROR | +-----------------------------------------------------------+ The resulting time will be affected by the value of the TZ environment variable. If the resulting time value precedes the Epoch, touch will exit immediately with an error status. The range of valid times is the Epoch to January 18, 2038. The range for SS is [00-61] rather than [00-59] because of leap seconds. If SS is 60 or 61, and the resulting time, as affected by the TZ environment variable, does not refer to a leap second, the resulting time will be one or two seconds after a time where SS is 59. If SS is not given, it is assumed to be 0. settime The following option is supported for the settime utility: -f ref_file Uses the corresponding times of the file named by ref_file instead of the current time. OPERANDS
The following operands are supported for the touch and settime utilities: file A path name of a file whose times are to be modified. date_time Uses the specified date_time instead of the current time. This operand is a decimal number of the form: MMDDhhmm[YY] where each two digits represent the following: MM The month of the year [01-12]. DD The day of the month [01-31]. hh The hour of the day [00-23]. mm The minute of the hour [00-59]. YY The second two digits of the year. YY is optional. If it is omitted, the current year will be assumed. If YY is specified, the year will be derived as follows: +-----------------------------------------------------------+ | YY Corresponding Year | |69-99 1969-1999 | |00-38 2000-2038 | |39-68 ERROR | +-----------------------------------------------------------+ If no -r option is specified, no -t option is specified, at least two operands are specified, and the first operand is an eight- or ten-digit decimal integer, the first operand will be assumed to be a date_time operand. Otherwise, the first operand will be assumed to be a file operand. USAGE
See largefile(5) for the description of the behavior of touch when encountering files greater than or equal to 2 Gbyte ( 2^31 bytes). When existing file access and modification times cannot be determined (which will occur if a call to stat(2) fails), both times can be changed to known values by settime and utime(2). However, in this case, touch -a (without -m) and touch -m (without -a) will fail because the unchanged time cannot be preserved. ENVIRONMENT VARIABLES
See environ(5) for descriptions of the following environment variables that affect the execution of touch: LANG, LC_ALL, LANG, LC_ALL, LC_CTYPE, LC_MESSAGES, and NLSPATH. TZ Determine the timezone to be used for interpreting the time option-argument or the date_time operand. EXIT STATUS
The following exit values are returned: 0 The touch utility executed successfully and all requested changes were made. >0 An error occurred. The touch utility returned the number of files for which the times could not be successfully modified. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |CSI |Enabled | +-----------------------------+-----------------------------+ |Interface Stability |Committed | +-----------------------------+-----------------------------+ |Standard |See standards(5). | +-----------------------------+-----------------------------+ SEE ALSO
stat(2), time(2), utime(2), attributes(5), environ(5), largefile(5), standards(5) NOTES
Users familiar with the BSD environment will find that for the touch utility, the -f option is accepted but ignored. The -f option is unnecessary because touch will succeed for all files owned by the user regardless of the permissions on the files. SunOS 5.11 9 Sep 2008 touch(1)
All times are GMT -4. The time now is 04:38 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy