11-14-2007
appending spaces to first line based on second record.
Hi,
I have a situation to append spaces to end of first record (header)and last record (footer) based on second record length.
The first record length is always 20.The second record will be different for different files.I have to append spaces for the first line based on second record length.The length of second record is also known.
Similarly for last record.Its length is also 25.i have to append spaces based on second record.The file is fixed width file.So that the record length will be same through out the file.
I have to do this for several files...
Please advice.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi all.
I am using /bin/sh on an HPUX system.
I have a file, with records as such:
60701006000000030380000000000000030380000400000000000
61001006000000008220000000000000008220000100000000000
61201006000000030150000000000000030150001000000000000
I know the character counts which... (5 Replies)
Discussion started by: lyoncc
5 Replies
2. Shell Programming and Scripting
Hi All,
I have a requirement, in which i have to append some spaces to the variable, and then send it to another function.
I am new to the UNIX shell programming. Ultimately the length of the string should be 40 characters.
exp:
Login = "rallapalli" (length = 10)
i have to append 30 spaces to... (2 Replies)
Discussion started by: rallapalli
2 Replies
3. Shell Programming and Scripting
Hi,
I want to print spaces in a trailer record which is a single command.
namely the unix command which i already have
recs=`wc -l $TargetFileDir/myfile.txt|cut -c1-9`;export recs;echo 'PCPC.DXDINPT.FC0.INPUTFLE.PASS'`date +%Y%m%d``printf '%015d\n' $recs` >> $TargetFileDir/myfile1.txt
I... (3 Replies)
Discussion started by: nvenkat010
3 Replies
4. UNIX for Dummies Questions & Answers
Hi,
I have a problem where I need to append few spaces(say 10 spaces) for each line in a file whose length is say(100 chars) and others leave as it is.
I tried to find the length of each line and then if the length is say 100 chars then tried to write those lines into another file and use a sed... (17 Replies)
Discussion started by: prathima
17 Replies
5. Shell Programming and Scripting
HI
i have record as shown below
402665,4X75,754X_FERNIE BC,12F2,008708,FERNIE BC,1,UTC ,UTC ,250
402665,4X75,754X_FERNIE BC,F212,008708,FERNIE BC,1,UTC ,UTC ,250
402665,4Y75,754Y_FERNIE BC,22F2,008708,FERNIE BC,1,UTC ,UTC ,250
here i want to remove multiple spaces into no... (3 Replies)
Discussion started by: raghavendra.cse
3 Replies
6. Shell Programming and Scripting
Hi,
I have a input file with the following entries:
1one
2two
3three
1four
2five
3six
1seven
1eight
1nine
2ten
The output should be
1one
2two
3three
1four
2five
3six (2 Replies)
Discussion started by: supchand
2 Replies
7. Shell Programming and Scripting
Hi,
I have a input file with the following entries:
1one
2two
3three
1four
2five
3six
1seven
1eight
1nine
2ten
2eleven
2twelve
1thirteen
2fourteen
The output should be: (5 Replies)
Discussion started by: supchand
5 Replies
8. Shell Programming and Scripting
Hello,
For the input file, I am trying to split those records which have multiple values seperated by '|' in the last input field, into multiple records and each record corresponds to the common input fields + one of the value from the last field.
I was trying with an example on this forum... (4 Replies)
Discussion started by: imtiaz99
4 Replies
9. Shell Programming and Scripting
Hi,
Here i'm using a awk inside bash script to validate the datafile by referring to the configuration file(schema file).
Here the validation check is done for datatype, field length and null values.
Once the validation is done on data file the error records are moved to the bad file. So... (22 Replies)
Discussion started by: shree11
22 Replies
10. Shell Programming and Scripting
I need to append |\r\n (a pipe character and CRLF) at end of each record in Unix to all records where they are not already present.
So first check for the presence of |\r\n and if absent append it else do nothing (3 Replies)
Discussion started by: abhilashnair
3 Replies
LEARN ABOUT OPENSOLARIS
audit
audit(2) System Calls audit(2)
NAME
audit - write a record to the audit log
SYNOPSIS
cc [ flag ... ] file ... -lbsm -lsocket -lnsl [ library... ]
#include <sys/param.h>
#include <bsm/libbsm.h>
int audit(caddr_t record, int length);
DESCRIPTION
The audit() function queues a record for writing to the system audit log. The data pointed to by record is queued for the log after a mini-
mal consistency check, with the length parameter specifying the size of the record in bytes. The data should be a well-formed audit
record as described by audit.log(4).
The kernel validates the record header token type and length, and sets the time stamp value before writing the record to the audit log.
The kernel does not do any preselection for user-level generated events. If the audit policy is set to include sequence or trailer tokens,
the kernel will append them to the record.
RETURN VALUES
Upon successful completion, 0 is returned. Otherwise, -1 is returned and errno is set to indicate the error.
ERRORS
The audit() function will fail if:
E2BIG The record length is greater than the maximum allowed record length.
EFAULT The record argument points outside the process's allocated address space.
EINVAL The header token in the record is invalid.
ENOTSUP Solaris Audit is not defined for this system.
EPERM The {PRIV_PROC_AUDIT} privilege is not asserted in the effective set of the calling process.
USAGE
Only privileged processes can successfully execute this call.
ATTRIBUTES
See attributes(5) for descriptions of the following attributes:
+-----------------------------+-----------------------------+
| ATTRIBUTE TYPE | ATTRIBUTE VALUE |
+-----------------------------+-----------------------------+
|Interface Stability |Committed |
+-----------------------------+-----------------------------+
|MT-Level |MT-Safe |
+-----------------------------+-----------------------------+
SEE ALSO
bsmconv(1M), audit(1M), auditd(1M), svcadm(1M), auditon(2), getaudit(2), audit.log(4), attributes(5), privileges(5)
NOTES
The functionality described in this man page is available only if the Solaris Auditing has been enabled and the audit daemon auditd(1M) has
not been disabled by audit(1M) or svcadm(1M). See bsmconv(1M) for more information.
SunOS 5.11 16 Apr 2008 audit(2)