Sponsored Content
Top Forums Shell Programming and Scripting Delimited records splitted into different lines Post 302972576 by Don Cragun on Saturday 7th of May 2016 09:24:55 PM
Old 05-07-2016
If you provide a clear description of your problem (instead of just one sample of a problem with no description), you will be more likely to get a response.

What are the line delimiters in your input file? UNIX single newline character delimiters or DOS carriage-return/newline character pair delimiters? Are the delimiters on split lines the same as in a correctly formatted line? Or, is the delimiter on split lines different from the delimiter on correctly formatted lines? What delimiters do you need in your output file?

How are we supposed to know when a line is complete?

Is your verification program supposed to know that there should be a specific number of fields in each input line? Is that number of fields the same for every file your verification program will process?

Is an invalid input line ALWAYS split between a pair of double quotes? Can we assume that a line needs to be combined with the next line from the input file if and only if an input line does not end with a double quote character?

Are invalid records always split by converting a space to a newline? How do we know whether or not a character needs to be added when lines are joined? Is a space character ALWAYS supposed to be added when lines are joined?

What operating system and shell are you using?

What have you tried to solve this problem on your own?
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Delete Duplicate records from a tilde delimited file

Hi All, I want to delete duplicate records from a tilde delimited file. Criteria is considering the first 2 fields, the combination of which has to be unique, below is a sample of records in the input file 1620000010338~2446694087~0~20061130220000~A00BCC1CT... (5 Replies)
Discussion started by: irshadm
5 Replies

2. UNIX for Dummies Questions & Answers

Extract records by column value - file non-delimited

the data in my file is has no delimiters. it looks like this: H52082320024740010PH333200612290000930 0.0020080131 D5208232002474000120070306200703060580T1502 TT 1.00 H52082320029180003PH333200702150001 30 100.0020080205 D5208232002918000120070726200707260580T1502 ... (3 Replies)
Discussion started by: jclanc8
3 Replies

3. Shell Programming and Scripting

how to Insert values in multiple lines(records) within a pipe delimited text file in specific cols

this is Korn shell unix. The scenario is I have a pipe delimited text file which needs to be customized. say for example,I have a pipe delimited text file with 15 columns(| delimited) and 200 rows. currently the 11th and 12th column has null values for all the records(there are other null columns... (4 Replies)
Discussion started by: vasan2815
4 Replies

4. Shell Programming and Scripting

Print records which do not have expected number of fields in a comma delimited file

Hi, I have a comma (,) delimited file, in which few fields are enclosed with in double quotes " ". I have to print the records in the file which donot have expected number of field with the line number. File1 ==== name,desgnation,doj,project #header#... (7 Replies)
Discussion started by: machomaddy
7 Replies

5. Shell Programming and Scripting

Create new lines using a delimited string.

Hi I have a text file called 'fileA' which contains the follwoing line examples 01:rec1:25,50,75,100 02:rec2:30,60 03:rec3:20,40 I would like to create a new file where each of the comma separated values appears on a new line but prefixed with the first two fields e.g. 01:rec1:25... (3 Replies)
Discussion started by: mackmb
3 Replies

6. UNIX for Dummies Questions & Answers

Removing empty lines at the end of a Tab-delimited file

I'm trying to remove all of the empty lines at the end of a Tab delimited file. They have no data just tabs. I've tried may things, here are a couple: sed /^\t.\t/d File1 > File2 sed /^\t{44}/d File1 > File2 What am I missing? (9 Replies)
Discussion started by: SirHenry1
9 Replies

7. UNIX for Advanced & Expert Users

Wanted best way to validate delimited file records

actually i post about this issue before but many folkz miss-understood with my quesion, We are checking for the delimited file records validation Delimited file will have data like this: Aaaa|sdfhxfgh|sdgjhxfgjh|sdgjsdg|sgdjsg| Aaaa|sdfhxfgh|sdgjhxfgjh|sdgjsdg|sgdjsg|... (3 Replies)
Discussion started by: Seshendranath
3 Replies

8. Shell Programming and Scripting

Script to match strings that sometimes are splitted in 2 lines

Hello to all, I have an hexdump -C format as below: 31 54 47 55 48 4c 52 31 5f 52 31 32 31 31 32 ff 44 00 00 0E 01 32 14 56 42 17 47 48 0f ff ff ff 44 00 00 01 32 14 56 00 23 83 95 2f 42 17 47 48 00 0f ff ff 00 15 00 0a 48 00 01 5a 00 02 17 00 00 2f 00 00 30 00 00 31 00 00 ff 34 ff 44 00... (23 Replies)
Discussion started by: Ophiuchus
23 Replies

9. UNIX for Dummies Questions & Answers

How to convert a comma delimited string to records or lines of text?

Hi, I am not sure if I've posted this question before. Anyway, I previously asked about converting lines of text into a comma delimited string. Now I am needing to do the other way around ... :( :o Can anyone advise how is this possible? Example as below: Converting records/lines to... (2 Replies)
Discussion started by: newbie_01
2 Replies

10. UNIX for Beginners Questions & Answers

Need help on an old post - How to convert a comma delimited string to records or lines of text?

Hi, Apologies in advance to the moderator if I am posting this the wrong way. I've searched and found the solution to an old post but as it is a very old post, I don't see an option to update it with additional question. The question I have is in relation to the following post: How to... (6 Replies)
Discussion started by: newbie_01
6 Replies
acctcms(8)						      System Manager's Manual							acctcms(8)

NAME
acctcms - Produces command usage summaries from accounting records SYNOPSIS
acctcms [-acjnspot] file ... FLAGS
Displays output in ASCII summary format rather than the default binary format. The acctcms command sorts its output in descending order according to total K-core minutes. The unit K-core minutes is the amount of storage used (in kilobytes) multiplied by the amount of time the buffer was in use. The hog factor is the total CPU time divided by the total real time. The ASCII summary output format has the fol- lowing headings: The COMMAND NAME column specifies the name of the command. Because only object modules are reported by the accounting system, the sh command entry specifies the entry for all shell processes, regardless of their actual names. The NUMBER CMDS column speci- fies the total number of command invocations during the accounting period. The TOTAL KCOREMIN column combines the amount of memory used and the length of time used. Memory is specified in kilobyte blocks, and time is specified in minutes. The TOTAL CPU-MIN column specifies the total CPU time needed to process the command the number of times specified in the NUMBER CMDS column. The TOTAL REAL-MIN column speci- fies the total number of real-time minutes needed to process the command the number of times specified in the NUMBER CMDS column. The MEAN SIZE-K column specifies the average amount of memory in kilobytes used to process the command the number of times specified in the NUMBER CMDS column. The MEAN CPU-MIN column specifies the average amount of CPU time that the command used each time it was processed. The mean CPU minutes are obtained by dividing the total CPU minutes by the total number of commands. The HOG FACTOR column specifies the CPU time needed to process the command the number of times specified in the NUMBER CMDS column with respect to the time required to process all com- mands. This value shows the ratio of system availability to system utilization. The CHARS TRANSFD column specifies the total number of characters that were read or written when the command was processed the number of times specified in the NUMBER CMDS column. The BLOCKS READ column specifies the number of file system blocks (1 block is equivalent to 1 kilobyte) that were read when the command was processed the number of times specified in the NUMBER CMDS column. The number of blocks read may not correspond with the number of characters trans- ferred. Sorts in descending order according to total CPU time rather than total K-core minutes. Combines all commands called only once in the column specified by "***other" in the COMMAND NAME column. Sorts in descending order according to the number of times each command was called. Displays a command summary of nonprime-time commands. Displays a command summary of prime-time commands. Assumes that any file specified after this flag is in binary format. Processes all records as total accounting records. The default binary format splits each heading into prime-time and nonprime-time parts. DESCRIPTION
The acctcms command outputs data in a format called TOTAL COMMAND SUMMARY. This command reads each file specified, combines and sorts all records for identically named processes, and writes them in a binary format to the output device. Files are usually organized in the acct file format. When you specify the -o and -p flags together, the acctcms command produces a summary report that combines commands processed during both prime and nonprime time. All the output summaries specify total usage, except for the number of times run, CPU minutes, and real minutes, which are split into prime-time and nonprime-time minutes. EXAMPLES
To collect command accounting records from one or more source files into a command summary file called today and to maintain a running total summary of commands in a file called cmtotal, add the following lines to an accounting shell script: acctcms [source File(s) ....] > today cp total prev_tot acctcms -s today prev_tot > cmtotal acctcms -a -s cmtotal First, the acctcms command is used to redirect command records in File(s) that you specify to a file called today. Next, the old total com- mand summary file is renamed prev_tot. Then, the command summary records that are collected in the today and the prev_tot files are redi- rected to a new command summary file called cmtotal. These are all binary files. The last acctcms command outputs to the default output device the contents of the cmtotal file in the ASCII default command summary format previously described, so that the report may be dis- played. FILES
Specifies the command path. This is where prime time is set. Accounting header files that define formats for writing accounting files. RELATED INFORMATION
Commands: acct(8), runacct(8) Functions: acct(2) delim off acctcms(8)
All times are GMT -4. The time now is 11:55 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy