Sponsored Content
Top Forums Shell Programming and Scripting Help using SYSTEM function in NAWK Post 302484285 by anurag.singh on Thursday 30th of December 2010 11:39:37 AM
Old 12-30-2010
I'm not sure if I understand your problem correctly. If not, please clarify.
I think that you are having problem with following cp command ran by system:
Code:
system("cp TMP ERR")

And you are expecting a file named "errorFile" to be created based on content of tmpFile.
If it is so, then problem is following:
argument to system command is being passed as string (In double quotes).HereTMP and ERR won't be treated as variable but just it's literal value.
And I guess there is no file with name "TMP", so cp will fail.
Even if there is a file called "TMP", ERROR file will be created with name "ERR".

You may try like below:
Code:
cmd="cp "TMP" "ERR;
if (error>0) system(cmd)

This User Gave Thanks to anurag.singh For This Post:
 

10 More Discussions You Might Find Interesting

1. Programming

system() function call...

Hi, Though I should check this myself.. but I don't have a cc compiler at this time.. :( When I compile a c program containing say system(myshell.sh).. do the executable require that the actual script myshell.sh to be present whenever it executes? I guess it needs.. otherwise I can just... (1 Reply)
Discussion started by: Vishnu
1 Replies

2. Shell Programming and Scripting

Nawk user-defined function

HELP!!!! I am in an on-line shell programming class and have a question. Here is the data: Mike Harrington:(510) 548-1278:250:100:175 Christian Dobbins:(408) 538-2358:155:90:201 Susan Dalsass:(206) 654-6279:250:60:50 (There are 12 contribuors total) This database contains names, phone... (1 Reply)
Discussion started by: NewbieGirl
1 Replies

3. Programming

system function in c

Hai Friends I have used the function system() to execute a command. My requirement is that i have to list the files in a directory applying some wildcard paterns. For example if i want to list *.c files i go with the function system("ls *.c"); and the output gets printed on the monitor.... (1 Reply)
Discussion started by: collins
1 Replies

4. UNIX for Dummies Questions & Answers

System() function in <stdlib.h>

Hi, guys ,, I want to know the implementation of System() function in C Unix, and its prototype definition: int system(const char * string) in the header file <stdlib.h> ??! please help me ! because that is part of my project !! (0 Replies)
Discussion started by: someone33
0 Replies

5. Shell Programming and Scripting

Nawk Time Function

Hi All, I am using solaris and nawk. Is there any time function in nawk which is simliar to the shell `date` function ? Can any experts show any examples? (4 Replies)
Discussion started by: Raynon
4 Replies

6. Shell Programming and Scripting

NAWK getline function

Hi, I am using a Solaris OS here. My intention is to print the 2nd field if the first field matches "APPLE=". I am using the "getline" function here (shown below), but it doesn;t work. Can any experts give me some advice? Input: ORANGE= 10 APPLE= 20 MANGO= 30 GRAPES= 40 Output: 20 ... (5 Replies)
Discussion started by: Raynon
5 Replies

7. UNIX for Dummies Questions & Answers

How to use ${?} and system() function???

Hi All, I am in a process to send the mail automatically with an attachment to bulk users. I have used 'Mailx' and 'Unencode' commands for the same and those worked fine. Please find below the same. X " ( cat /sastemp/body.txt; uuencode test.xls test.xls ) | mailx -s 'testing'... (1 Reply)
Discussion started by: manas6
1 Replies

8. Shell Programming and Scripting

NAWK - looping with match() function

i'm trying to use the "before" output from the match() function as part of the results of each Regex match... but... My input data: (from an input file) i only show the first record in my file.. all other records are similar. mds_ar/bin/uedw92wp.ksh:cat $AI_SQL/wkly_inqry.sql... (2 Replies)
Discussion started by: danmauer
2 Replies

9. UNIX for Dummies Questions & Answers

Using system function in C

Hi Guys , I want to use system function in C to do the following work. cp <file1> <file2> and then ><file1> e,g cp \var\log\cpm_cpmd_1.log.1 \var\log\cpm_cpmd_1.log.2 and then >\var\log\cpm_cpmd_1.log.1 1. g_config_info.cpmm_config.cpm_log_path=\var\log\ 2. ... (3 Replies)
Discussion started by: meet123321
3 Replies

10. Shell Programming and Scripting

Nawk Problem - nawk out of space in tostring on

Hi.. i am running nawk scripts on solaris system to get records of file1 not in file2 and find duplicate records in a while with the following scripts -compare nawk 'NR==FNR{a++;next;} !a {print"line"FNR $0}' file1 file2duplicate - nawk '{a++}END{for(i in a){if(a-1)print i,a}}' file1in the middle... (12 Replies)
Discussion started by: Abhiraj Singh
12 Replies
BUGFILER(8)						      System Manager's Manual						       BUGFILER(8)

NAME
bugfiler - file bug reports in folders automatically SYNOPSIS
bugfiler [ mail directory ] DESCRIPTION
Bugfiler is a program to automatically intercept bug reports, summarize them and store them in the appropriate sub directories of the mail directory specified on the command line or the (system dependent) default. It is designed to be compatible with the Rand MH mail system. Bugfiler is normally invoked by the mail delivery program through aliases(5) with a line such as the following in /etc/aliases. bugs:"|bugfiler /usr/bugs/mail" It reads the message from the standard input or the named file, checks the format and returns mail acknowledging receipt or a message indi- cating the proper format. Valid reports are then summarized and filed in the appropriate folder; improperly formatted messages are filed in a folder named ``errors.'' Program maintainers can then log onto the system and check the summary file for bugs that pertain to them. Bug reports should be submitted in RFC822 format and aremust contain the following header lines to be properly indexed: Date: <date the report is received> From: <valid return address> Subject: <short summary of the problem> Index: <source directory>/<source file> <version> [Fix] In addition, the body of the message must contain a line which begins with ``Description:'' followed by zero or more lines describing the problem in detail and a line beginning with ``Repeat-By:'' followed by zero or more lines describing how to repeat the problem. If the keyword `Fix' is specified in the `Index' line, then there must also be a line beginning with ``Fix:'' followed by a diff of the old and new source files or a description of what was done to fix the problem. The `Index' line is the key to the filing mechanism. The source directory name must match one of the folder names in the mail directory. The message is then filed in this folder and a line appended to the summary file in the following format: <folder name>/<message number> <Index info> <Subject info> The bug report may also be redistributed according to the index. If the file maildir/.redist exists, it is examined for a line beginning with the index name followed with a tab. The remainder of this line contains a comma-separated list of mail addresses which should receive copies of bugs with this index. The list may be continued onto multiple lines by ending each but the last with a backslash (`'). FILES
/usr/sbin/sendmail mail delivery program /usr/libexec/unixtomh converts unix mail format to mh format maildir/.ack the message sent in acknowledgement maildir/.format the message sent when format errors are detected maildir/.redist the redistribution list maildir/summary the summary file maildir/Bf?????? temporary copy of the input message maildir/Rp?????? temporary file for the reply message. SEE ALSO
mh(1), newaliases(1), aliases(5) BUGS
Since mail can be forwarded in a number of different ways, bugfiler does not recognize forwarded mail and will reply/complain to the for- warder instead of the original sender unless there is a `Reply-To' field in the header. Duplicate messages should be discarded or recognized and put somewhere else. 4.2 Berkeley Distribution October 23, 1996 BUGFILER(8)
All times are GMT -4. The time now is 06:15 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy