10-07-2008
End of record markers
I have a file with thousands of 80 character records.
Unfortunately, there are no end of record characters, so any normal script commands that I've tried will process the entire file as one record.
I.E. If I use grep to find the record that contains some specific value, I either get nothing if it's not found, or the entire file, regardless of how many times the string exists. Obviously, I only want the 80 character records that have the string I'm looking for.
How can I convert the file to be true 80 character records so I can use normal script commands?
Thanks
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
hello.,
i have a .txt file.
inside the .txt file i have.,
/home/ss/cca.costco.transaction_date
/home/sk/cca.costco.transaction_date
/home/st/cca.costco.transaction_date
/home/sv/cca.costco.transaction_date
cca.costco.transaction_date is the file name.
inside the file there are some... (2 Replies)
Discussion started by: pavan_test
2 Replies
2. Shell Programming and Scripting
Hi Gurus,
I have 13 comma(,) seperated files that i have to merge and create a single file which has file name attached at th end of each record in the out put file. Can any one please help me with writing a unix script with this issue?
test1.dat
BIG ID,Local ID,Bond... (2 Replies)
Discussion started by: vkr
2 Replies
3. Shell Programming and Scripting
I have file format like below and I'm trying to modify this file.
I need to add 'ENDEND' end of each record.
01 ASH01 1CTCTL EDPPOO STAND
01 ASH08 0020 A1TH 101
01 ASH09 0022 A1TH 102
01 ASH09 0022 A1TH 103
01 ASH02 2CTCTL ... (5 Replies)
Discussion started by: naveenkcl
5 Replies
4. Shell Programming and Scripting
Hi all,
i have to append a record at the end of the file(a file which is already with some records).how do i do?please help me?
is there any way of doing this with "SED" command.i am not sure.plz help me on this.
would appreciate your ideas!!!!
bye
rao. (3 Replies)
Discussion started by: raoscb
3 Replies
5. Shell Programming and Scripting
hi,
Does anyone has any idea in adding few blank spaces at the end of every record in a file.
Eg:
file.txt
Baby Boy Kim 1234
Baby Boy Vik 1334
Desired output:-
output.txt
Baby Boy Kim 1234
Baby Boy Vik 1334
I want to add 10 blank spaces at the end every record in file.txt (3 Replies)
Discussion started by: techmoris
3 Replies
6. Shell Programming and Scripting
Need to add end of line character to last record in a fixed width file.
When i take the record length of each line, for all the records it gives example like 200 except the last line as 199.
Due to this my other script fails.
Please help me on this. (4 Replies)
Discussion started by: Amrutha24
4 Replies
7. Shell Programming and Scripting
Hi All,
Could you please help me to achieve below solution.
I have a FILE1.txt as below.TEXAS CALIFORNIA TEXAS
DALLAS CALIFORNIA CALIFORNIA DALLAS
DALLAS TEXAS TEXAS DALLAS
NEW YORK NEW YORk
FILE2.txt as below.TEXAS,TX
DALLAS,DA
Now I need to compare the string in FILE2.txt... (6 Replies)
Discussion started by: ureddy
6 Replies
8. 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
9. Shell Programming and Scripting
Hi Unix forum.
I have the following requirement to add a sequence value to each record in a file but only if it meets certain conditions. Field value in pos. 1 and 2 must be '0B' or 'OA' else leave as is. Sequence value must be preserved for each OB and OA pair.
Data Before:
123
456... (5 Replies)
Discussion started by: pchang
5 Replies
10. UNIX for Advanced & Expert Users
Hi,
I have a file in unix with 15 columns.It consists special characters(#,$,^M,@,*,% etc)at the end of the each record.I want to remove these special characters.I used the following:
Sed -e 's/ /g;s/ */ /g'
. But It is removing special characters exists everywhere in the file(begining,middle... (24 Replies)
Discussion started by: rakeshp
24 Replies
LEARN ABOUT HPUX
acctwtmp
acct(1M) acct(1M)
NAME
acct: acctdisk, acctdusg, accton, acctwtmp, closewtmp, utmp2wtmp - overview of accounting and miscellaneous accounting commands
SYNOPSIS
file] file]
[file]
reason
DESCRIPTION
Accounting software is structured as a set of tools (consisting of both C programs and shell procedures) that can be used to build account-
ing systems. The shell procedures, described in acctsh(1M), are built on top of the C programs.
Connect time accounting is handled by various programs that write records into the The programs described in acctcon(1M) convert this file
into session and charging records which are then summarized by (see acctmerg(1M)).
Process accounting is performed by the HP-UX system kernel. Upon termination of a process, one record per process is written to a file
(normally The programs in acctprc(1M) summarize this data for charging purposes; is used to summarize command usage (see acctcms(1M)).
Current process data can be examined using (see acctcom(1M)).
Process accounting and connect time accounting (or any accounting records in the format described in acct(4)) can be merged and summarized
into total accounting records by (see the format in acct(4)). is used to format any or all accounting records (see acctsh(1M)).
reads lines that contain user ID, login name, and number of disk blocks, and converts them to total accounting records that can be merged
with other accounting records.
reads its standard input (usually from and computes disk resource consumption (including indirect blocks) by login. Only files found under
login directories (as determined from the password file) are accounted for. All files under a login directory are assumed to belong to
that user regardless of actual owner. If is given, records consisting of those file names for which charges no one are placed in file (a
potential source for finding users trying to avoid disk charges). If is given, file is the name of the password file. This option is not
needed if the password file is (See diskusg(1M) for more details.)
turns process accounting off if the optional file argument is omitted. If file is given, it must be the name of an existing file, to which
the kernel appends process accounting records (see acct(2) and acct(4)).
writes a utmp record to its standard output if the option is not used. If the option is used, writes a record to The record contains the
current time and a string of characters that describe the reason for writing the record. A record type of is assigned (see utmp(4) and
utmps(4)). The string argument reason must be 11 or fewer characters, numbers, or spaces if option is not used. Otherwise, it must be 63
or fewer characters, numbers, or spaces. For example, the following are suggestions for use in reboot and shutdown procedures, respec-
tively:
writes a record, for each user currently logged in, to the file This program is invoked by runacct to close the existing file before creat-
ing a new one.
writes a record, for each user currently logged in, to the file This program is invoked by runacct to initialize the newly created file.
FILES
Holds all accounting commands listed in section(1M) of this manual.
Current process accounting file.
Used for converting login name to user ID
Login/logoff history file.
New login/logoff history database.
SEE ALSO
acctcms(1M), acctcom(1M), acctcon(1M), acctmerg(1M), acctprc(1M), acctsh(1M), diskusg(1M), fwtmp(1M), runacct(1M), acct(2), acct(4),
utmp(4). utmps(4), wtmps(4).
STANDARDS CONFORMANCE
acct(1M)