Sponsored Content
Top Forums Shell Programming and Scripting Editing long records with characters that need to be escaped. Post 302349566 by Macs_Linux on Tuesday 1st of September 2009 09:00:25 AM
Old 09-01-2009
This could be an example of a record I have to work with:

Code:
2009-07-20 17:18:03.0,"15.134.13.45.13","XXXXXX","15.134.13.45.13","xxxxxxx.xxxxxxx.IT","PIN6","SQLPLUS","PFZ5","SELECT","SIP_JDSIS3_T","IFRI","='3435354454334'","select PfrfID_ID0, substr(IFRI,1,15) IFRI2, substr(ORIGINARY_IFRI,1,15) ""TO_CHAR(CAST((( TIMESTAMP '1970-01-01 00:00:00 GMT' + numtodsinterval(ROUND(CREATED_T), 'SECOND') ) at TIME ZONE 'MET') AS DATE), 'DD/MM/YYYY HH24:MI.SS') CREATED,  TO_CHAR(CAST((( TIMESTAMP '1970-01-01 00:00:00 GMT' + numtodsinterval(ROUND(CREATION_DATE), 'SECOND') ) at TIME ZONE 'MET') AS DATE), 'DD/MM/YYYY HH24:MI.SS') CREAT_DATE,  TO_CHAR(CAST((( TIMESTAMP '1970-01-01 00:00:00 GMT' + numtodsinterval(ROUND(MOD_T), 'SECOND') ) at TIME ZONE 'MET') AS DATE), 'DD/MM/YYYY HH24:MI.SS') from SIP_IFR03_T where IORI='3653453437941'","1"

I read it from a csv file in UNIX format.
The result of the simple script example I posted before is that this informations are printed in multiple lines... and some caracters are disappearing, so I have no possibility to work with it...

I really have no idea......

Thank you!

---------- Post updated at 03:00 PM ---------- Previous update was at 02:56 PM ----------

My intention was to use the pattern "," as separator for the field and add an empty field where it needs it, with awk.

But Double Quote are disappearing...And the single record is splitted in little parts...

mmm...

Last edited by vgersh99; 09-02-2009 at 01:47 PM.. Reason: code tags, PLEASE!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to deal with long records (> 8k)??

Still working on manipulating SQL statements. Some are very long (10-20k). I'm using a shell script to read the SQL statements that are stored in a DB2 table and writing the records out to a file on Unix. The records appear to be getting truncated at 8k. Is there any way for me to avoid the... (1 Reply)
Discussion started by: bradtri2
1 Replies

2. Shell Programming and Scripting

problems with sed and bash. Escaped characters ?

Hi, I'm writing a long script for bash (on RHEL 5.0) to execute many commands. So, my idea is to create a function to deal with error checking and logging (see ceckoutput() below). This works with all commands except for sed. I think it may be a problems with escaped characters. So I did the... (4 Replies)
Discussion started by: macL
4 Replies

3. Shell Programming and Scripting

count characters in specific records

I have a text file which represents a http flow like this: HTTP/1.1 200 OK Date: Fri, 23 Jan 2009 17:16:24 GMT Server: Apache Last-Modified: Fri, 23 Jan 2009 17:08:03 GMT Accept-Ranges: bytes Cache-Control: max-age=540 Expires: Fri, 23 Jan 2009 17:21:31 GMT Vary: Accept-Encoding ... (1 Reply)
Discussion started by: littleboyblu
1 Replies

4. Shell Programming and Scripting

Breaking long lines into (characters, newline, space) groups

Hello, I am currently trying to edit an ldif file. The ldif specification states that a newline followed by a space indicates the subsequent line is a continuation of the line. So, in order to search and replace properly and edit the file, I open the file in textwrangler, search for "\r " and... (14 Replies)
Discussion started by: rowie718
14 Replies

5. Shell Programming and Scripting

Trim leading zeros to make field 6 characters long

Hi all- I've got a file that will have multiple columns. In one column there will be a string that is 10 digits in length, but I need to trim the first four zeros to make it 6 characters? example: 0000001234 0000123456 0000234566 0000000321 output: 001234 123456 234566 000321 (5 Replies)
Discussion started by: Cailet
5 Replies

6. Programming

How i can read a long integer from standar input and a string with as many characters as specified..

how i can read a long integer from standar input and a string with as many characters as specified in the number? i thing that i must use the read command ofcourse.... (6 Replies)
Discussion started by: aintour
6 Replies

7. Solaris

Reason why some commands need escaped-characters and other not

Hi, this is my first post and hope to make some contribution soon. I'm still learning the basics of UNIX and Linux and BASH. Thus my need to understand the subject at hand. I don't have a problem with technical detail, so hit me :) I have a script where two commands use the contents of a... (2 Replies)
Discussion started by: doublefrangelic
2 Replies

8. Shell Programming and Scripting

Help in Editing Records of a file

Hi Friends , Need help here , I Have a file which has as a number of rows (records) in it . 00012919 7836049 S 00012920 7836049 S 00012921 3828157 Y 00012922 3828157 Y 00012923 3828157 S T005290070331000012923 I Have another file which has few more... (3 Replies)
Discussion started by: robert89
3 Replies

9. Windows & DOS: Issues & Discussions

How to copy a file with long records ,i.e spanning to 2 or 3 lines from UNIX to excel?

Hi Experts, I have a Unix csv file which has long records ie the record length is more than 80 so it goes to the next line.So when its in unix though it spans to two or three lines it still counts it as one record. But what is happening is for the records that are long when i copy it into excel i... (0 Replies)
Discussion started by: 100bees
0 Replies

10. UNIX for Dummies Questions & Answers

Editing long text file

Good morning all, I have a machine running IRIX and I need to edit a text file on the terminal that is literally thousands of lines. Does anyone know the most efficient way to edit portions of files like these? Obviously simply using the vi command isn't going to work since I get a too many lines... (1 Reply)
Discussion started by: James C
1 Replies
acctprc(8)						      System Manager's Manual							acctprc(8)

NAME
acctprc1, acctprc2, accton - Perform process-accounting procedures SYNOPSIS
acctprc1 [InFile] acctprc2 accton [OutFile] DESCRIPTION
The three acctprc commands, acctprc1, acctprc2, and accton, are used in the runacct shell procedure to produce process-accounting reports. acctprc1 [InFile] The acctprc1 command is used to read records from standard input that are in a format defined by the acct structure in the /usr/include/sys/acct.h header file. This process adds the login names that correspond to user IDs, and then writes corresponding ASCII records to standard output. For each process, the record format includes the following seven unheaded columns: The user ID column includes both traditional and assigned user identification numbers listed in the /etc/passwd file. The login name is the one used for the user ID in the /etc/passwd file. The number of seconds the process consumed when executed during prime-time hours. Prime-time and nonprime-time hours are defined in the /usr/sbin/acct/holidays file. The number of seconds the process consumed when executed during nonprime-time hours. Total number of characters transferred. Total number of blocks read and written. Mean memory size (in kilobyte units). When specified, InFile contains a list of login sessions in a format defined by the utmp structure in the /usr/include/utmp.h header file. The login session records are sorted according to user ID and login name. When InFile is not specified, acctprc1 gets login names from the password file /etc/passwd. The information in InFile is used to distinguish different login names that share the same user ID. acctprc2 The acctprc2 command reads, from standard input, the records written by acctprc1, summarizes them according to user ID and name, and writes sorted summaries to standard output as total accounting records in the tacct format (see the acctmerg command). accton [OutFile] When no parameters are specified with the accton command, account processing is turned off. When you specify an existing OutFile file, process accounting is turned on, and the kernel adds records to that file. You must specify an Outfile to start process accounting. Many shell script procedures expect the file name /var/adm/pacct, the standard process-accounting file. EXAMPLES
To add a user name to each process-accounting record in a binary file and then write these modified binary-file records to an ASCII file named out.file, enter the following line to an accounting shell script: /usr/sbin/acct/acctprc1 < /var/adm/pacct >out.file A user name is added to each record. The raw data in the pacct file is converted to ASCII and added to file out.file. To produce a total binary accounting record of the ASCII output file out.file produced in example 1, enter the following line to an accounting shell script: /usr/sbin/acct/acctprc2 < out.file > /var/adm/acct/nite/daytacct The resulting binary total accounting file, written in the acct format, contains records sorted by user ID. This sorted user ID file, is usually merged with other total accounting records when an acctmerg command is processed to produce a daily summary accounting record called /var/adm/acct/sum/daytacct. To turn on process accounting, enter: /usr/sbin/acct/accton /var/adm/pacct To turn off process accounting, enter: /usr/sbin/acct/accton FILES
Specifies the command path. Specifies the command path. Specifies the command path. RELATED INFORMATION
Commands: acct(8), acctcms(8), acctmerg(8), runacct(8) Functions: acct(2) delim off acctprc(8)
All times are GMT -4. The time now is 06:48 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy