Sponsored Content
Full Discussion: file update
Top Forums Shell Programming and Scripting file update Post 80833 by mbb on Friday 12th of August 2005 10:19:00 AM
Old 08-12-2005
Quote:
Originally Posted by piyush_movadiya
i want to update my content in file.
like account holder deposite may be increase or discrease what i do?
Sorry, but your question still seems a little open ended. Lets start with identifiying some of the details of your problem:

1) Is your file a binary file, or ASCII file?
2) What identifies a particular account or entry? e.g. account number
3) What is the record structure for an account or entry?

In general terms you may want to consider using the sed or awk command. Read the contents of your file from standard input. The sed or awk commands will allow you to subsitute some of the input stream as you send it to standard output.
 

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
LASTCOMM(1)						    BSD General Commands Manual 					       LASTCOMM(1)

NAME
lastcomm -- show last commands executed SYNOPSIS
lastcomm [-EScesu] [-f file] [+format] [command ...] [user ...] [terminal ...] DESCRIPTION
The lastcomm utility gives information on previously executed commands. With no arguments, lastcomm prints information about all the com- mands recorded during the current accounting file's lifetime. The following options are available: -E Print the time the process exited. -S Print the time the process started. -c Print the amount of cpu time used by the process. -e Print the amount of elapsed time used by the process. -s Print the amount of system time used by the process. -u Print the amount of user time used by the process. -f file Read from file rather than the default /var/account/acct. If file is a single dash ('-') lastcomm reads accounting entries from the standard input. An operand with a leading plus sign ('+') is followed a user-defined format string which specifies the format in which to display the process's start or exit date and time. The format string may contain any of the conversion specifications described in the strftime(3) man- ual page, as well as arbitrary text. If no options are specified, -cS is assumed. If lastcomm is invoked with arguments, only accounting entries with a matching command name, user name, or terminal name are printed. For example: lastcomm a.out root ttyd0 would produce a listing of all the executions of commands named a.out by user root on the terminal ttyd0. For each process entry, the following are printed. o The name of the user who ran the process. o Flags, as accumulated by the accounting facilities in the system. o The command name under which the process was called. o The amount of CPU (-c), wall (-e), system (-s), or user (-u) time used by the process (in seconds). o The time the process started (-S) or exited (-E). The flags are encoded as follows: ``S'' indicates the command was executed by the super-user, ``F'' indicates the command ran after a fork, but without a following exec(3), ``D'' indicates the command terminated with the generation of a core file, and ``X'' indicates the command was terminated with a signal. By default, accounting entries are printed going backwards in time, starting from the time lastcomm was executed. However, if lastcomm reads entries from its standard input, then entries are printed in the order they are read. FILES
/var/account/acct default accounting file EXAMPLES
The command lastcomm -Ee will print the exit time and elapsed time of each command logged in /var/account/acct, while tail -f -c 0 /var/account/acct | lastcomm -f - will print details of each terminating command. SEE ALSO
last(1), sigaction(2), strftime(3), acct(5), core(5) HISTORY
The lastcomm command appeared in 3.0BSD. BSD
May 17, 2012 BSD
All times are GMT -4. The time now is 02:46 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy