Sponsored Content
Top Forums Shell Programming and Scripting Can we convert a '|' file into a fixed lenght??? Post 302119333 by kumarsaravana_s on Tuesday 29th of May 2007 09:00:11 AM
Old 05-29-2007
Can we convert a '|' file into a fixed lenght???

Hi All,

I have a pipe separated flat file.But there is often some problem with the records.So is it possible to convert the '|' separated file into a fixed length file by means of some script.

The file has 11 columns which means 10 pipes.Your help is appreciated.

i'm using Sun OS Version 5.10

Thank you,
Kumar
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

convert XML file into Text file(fixed length)

If someone out there could help me out with this problem. I would really appreciate it. I am trying to convert xml into text file(fixed length) using Unix Borne shell scripts. My xml file: <root> <header_rec recordtype="00"> <record_id>00</record_id> ... (0 Replies)
Discussion started by: ram2s2001
0 Replies

2. Shell Programming and Scripting

how to convert Fixed length file to delimited file.

I have below fixed lenth file . I have to convert this to delimitted file. File1.txtE116005/29/19930E001E000 E12201/23/19940E001E003 E10406/4/19940E001E003 I want to convert this to : E116,0,05/29/1993,0,E001,E000 E122,0,1/23/1994,0,E001,E003 E104,0,6/4/1994,0,E001,E003 I have a... (7 Replies)
Discussion started by: satyam_sat
7 Replies

3. Shell Programming and Scripting

convert fixed length file to CSV

Newbie Looking for a script to convert my input file to delimited text file. Not familier with AWK or shell programing. Below is sample record in my input file and the expected output format. My OS is HPUX 11.23. Thanks in advance for your assistance. tbtbs input file:... (12 Replies)
Discussion started by: tbtbs
12 Replies

4. UNIX for Dummies Questions & Answers

Convert Variable file to fixed file.

I have a set of variable date log files /tmp/test/test1_<YYYYMMDD>_A.log /tmp/test/test2_<YYYYMMDD>_B.log /tmp/test/test3_<YYYYMMDD>_C.log /tmp/test/test4_<YYYYMMDD>_D.log /tmp/test/test5_<YYYYMMDD>_E.log which should be converted (should have content of all the above listed files) into... (1 Reply)
Discussion started by: abhi9845
1 Replies

5. Shell Programming and Scripting

Convert Variable file to fixed file.

I have a set of variable date log files /tmp/test/test1_<YYYYMMDD>_A.log /tmp/test/test2_<YYYYMMDD>_B.log /tmp/test/test3_<YYYYMMDD>_C.log /tmp/test/test4_<YYYYMMDD>_D.log /tmp/test/test5_<YYYYMMDD>_E.log which should be converted (should have content of all the above listed files) into... (9 Replies)
Discussion started by: abhi9845
9 Replies

6. UNIX for Dummies Questions & Answers

Convert a tab delimited/variable length file to fixed length file

Hi, all. I need to convert a file tab delimited/variable length file in AIX to a fixed lenght file delimited by spaces. This is the input file: 10200002<tab>US$ COM<tab>16/12/2008<tab>2,3775<tab>2,3783 19300978<tab>EURO<tab>16/12/2008<tab>3,28523<tab>3,28657 And this is the expected... (2 Replies)
Discussion started by: Everton_Silveir
2 Replies

7. UNIX for Dummies Questions & Answers

convert # delimited text file to fixed width

Hello gurus, I have a file containing 5 columns delimited by '#' as shown in the example below: HRP1000-PLVAR#HRP1000-OTYPE#HRP1000-OBJID#HRP1000-BEGDA#HRP1000-ENDDA# 99991231#AU7129#000000000#1 PROCTER & GAMBLE# 99991231#TT4283#1000013883#21111 LAUNDRY# 99991231#TT4283#1000013884#21121 DISH... (3 Replies)
Discussion started by: chumsky
3 Replies

8. UNIX for Advanced & Expert Users

how to find lenght of fixed width file record?

actually i am trying to find the lenght of fixed width file record reading from teradata db but its not working can u guys help me out? code which i wrote--- colmn_lngth=`cat $RPT_FILE | awk -F~ '{print $1}'` rm $RPT_FILE while read line do result=`echo $line | wc -m` ... (4 Replies)
Discussion started by: Seshendranath
4 Replies

9. Shell Programming and Scripting

Remove new line character and add space to convert into fixed width file

I have a file with different record length. The file as to be converted into fixed length by appending spaces at the end of record. The length should be calculated based on the record with maximum length in the file. If the length is less than the max length, the spaces should be appended... (4 Replies)
Discussion started by: Amrutha24
4 Replies

10. UNIX for Beginners Questions & Answers

Convert a fixed width file to a delimited file

Hi - this is a generic question .... is there any utility which can convert a fixed width file format to a delimited file (any given character delimited) ? (5 Replies)
Discussion started by: i4ismail
5 Replies
PIPE(2) 						      BSD System Calls Manual							   PIPE(2)

NAME
pipe, pipe2 -- create descriptor pair for interprocess communication LIBRARY
Standard C Library (libc, -lc) SYNOPSIS
#include <unistd.h> int pipe(int fildes[2]); int pipe2(int fildes[2], int flags); DESCRIPTION
The pipe() system call creates a pipe, which is an object allowing bidirectional data flow, and allocates a pair of file descriptors. The pipe2() system call allows control over the attributes of the file descriptors via the flags argument. Values for flags are constructed by a bitwise-inclusive OR of flags from the following list, defined in <fcntl.h>: O_CLOEXEC Set the close-on-exec flag for the new file descriptors. O_NONBLOCK Set the non-blocking flag for the ends of the pipe. If the flags argument is 0, the behavior is identical to a call to pipe(). By convention, the first descriptor is normally used as the read end of the pipe, and the second is normally the write end, so that data written to fildes[1] appears on (i.e., can be read from) fildes[0]. This allows the output of one program to be sent to another program: the source's standard output is set up to be the write end of the pipe, and the sink's standard input is set up to be the read end of the pipe. The pipe itself persists until all its associated descriptors are closed. A pipe that has had an end closed is considered widowed. Writing on such a pipe causes the writing process to receive a SIGPIPE signal. Widowing a pipe is the only way to deliver end-of-file to a reader: after the reader consumes any buffered data, reading a widowed pipe returns a zero count. The bidirectional nature of this implementation of pipes is not portable to older systems, so it is recommended to use the convention for using the endpoints in the traditional manner when using a pipe in one direction. RETURN VALUES
The pipe() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error. ERRORS
The pipe() and pipe2() system calls will fail if: [EMFILE] Too many descriptors are active. [ENFILE] The system file table is full. [ENOMEM] Not enough kernel memory to establish a pipe. The pipe2() system call will also fail if: [EINVAL] The flags argument is invalid. SEE ALSO
sh(1), fork(2), read(2), socketpair(2), write(2) HISTORY
The pipe() function appeared in Version 3 AT&T UNIX. Bidirectional pipes were first used on AT&T System V Release 4 UNIX. The pipe2() function appeared in FreeBSD 10.0. BSD
May 1, 2013 BSD
All times are GMT -4. The time now is 02:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy