Sponsored Content
Full Discussion: SED on AIX Limitation
Top Forums Shell Programming and Scripting SED on AIX Limitation Post 302495457 by nemesis.spa on Thursday 10th of February 2011 10:18:00 AM
Old 02-10-2011
Java

Copy a part of the script. This code is inside a loop that will receive files.
Sorry for the comments, becose they are in Spanish

Code:
        # Variables que almacenan las longitudes de cabecera, registro y fragmentacion
        CHAR_CABECERA=22        # !!!!!!! A la cabecera debe sumarse 1
        CHAR_CABECERA=`expr $CHAR_CABECERA + 1`
        CHAR_REGISTRO=1850
        # Si se elimina el Ășo campo no habra separador al final
        # Estos datos se obtienen con el valor de cada campo, empezando por el primero sin modificar, y los siguiente, sumandoles el anterior + 1 (el caracter de separacion)
        set -A SEPARADORES 14 21 31 41 49 59 62 75 86 97 104 1305 1406 1707 1709 1714 1723 1727 1731 1736 1739 1742 1758 1774 1778 1782 1784 1789 1805 1808 1812 1815 1818 1823 1827 1829 1831 1833 1835 1837 1848 1889 1892
        # Bucle que va pasando por todos los ficheros encontrados con un patron
        for i in `cat $LST_TMP_PUS`
        do
                # Ficheros temporales donde se realizaran los mapeos
                CABECERA=$TMP_DIR/$i.Ncab
                TMP_MAP_FILE=$TMP_DIR/$i.Tmap
        ## CAMBIAR DIRECTORIO AL QUE SE VUELCAN LOS DATOS
                MAP_FILE=$RES_DIR/$i.map
                # Eliminamos la cabecera, cortamos el fichero por longitudes de registro, dejamos un registro por linea y eliminamos la ultima linea en blanco
                # cut -b$CHAR_CABECERA- $i | sed 's/\(.\{'$CHAR_REGISTRO'\}\)/&\n/g' > $CABECERA
                cut -b$CHAR_CABECERA- $i | sed 's_\(.\{'$CHAR_REGISTRO'\}\)_&\n_g' > $CABECERA
                # Volcamos el contenido del fichero sin fragmentar el registro al fichero que contendra los datos finales
                cat $CABECERA > $TMP_MAP_FILE
                # Bucle en el que formateamos el fichero
                        echo "Comienzo fichero $i separadores"
                for j in ${SEPARADORES[*]}
                do
                        echo "Problema en los separadores"
                        # Formateo del fichero registro a registro, se ha de tener en cuenta que cada registro se ha de sumar al anterior + el caracter de separacion
                        # cat $TMP_MAP_FILE | sed 's/^\(.\{'$j'\}\)/&;/g' > $MAP_FILE
                        cat $TMP_MAP_FILE | sed 's_^(.{$j})_&;_g' > $MAP_FILE
                        cat $MAP_FILE > $TMP_MAP_FILE
                        cat $MAP_FILE >> $RES_PUS
                # Fin - Bucle en el que formateamos el fichero
                done
                # Se eliminan los ficheros temporales
                rm $CABECERA $TMP_MAP_FILE $MAP_FILE
        # Fin - Bucle que va pasando por todos los ficheros encontrados con un patron
        done


Last edited by nemesis.spa; 02-10-2011 at 11:34 AM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

find limitation

Hi , i'm trying to use "find "command with "-size "option but i encounter 2gb file limitation. Can you confirm this limitation ? Is there a simple way to do the same thing ? My command is : <clazz01g-notes01>/base/base01 # find /base/base01 -name '*.nsf' -size +5242880000c -exec ls... (2 Replies)
Discussion started by: Nicol
2 Replies

2. HP-UX

HP-UX 11i - File Size Limitation And Number Of Folders Limitation

Hi All, Can anyone please clarify me the following questions: 1. Is there any file size limitation in HP-UX 11i, that I can able to create upto certain size of file (say 2 GB) and not more then that???? 2. At max. how many files we can able to keep inside a folder???? 3. How many... (2 Replies)
Discussion started by: sundeep_mohanty
2 Replies

3. UNIX for Dummies Questions & Answers

grep limitation

Hello, I am looking for a way to get around an issue, as I am using the grep command in a very common situation: grep ^50 File.*.txt | "some awk process" My problem is that bash throws me an error on the grep command if the directory in question contains several thousands files. ... (6 Replies)
Discussion started by: Indalecio
6 Replies

4. Shell Programming and Scripting

sed limitation of 255 characters

Gurus, sed -e "s/\(.\{1,255\}\)\(.\{1,2\}\)\(.*\)/\1AB\3/" FILE ---this works sed -e "s/\(.\{1,468\}\)\(.\{1,2\}\)\(.*\)/\1AB\3/" FILE ---this does not It works only till 1,255 ( any number below 255 works) Any one know how to increase this limit. Thanks Sirababu (4 Replies)
Discussion started by: sirababu
4 Replies

5. AIX

AIX 5.3 : Limitation to 1 telnet session for some users

Hi, I search the way to limit, for a group on a AIX 5.3, one telnet session by user (Simultaneous). I search a lot in /etc/security but the only way found is with the pam authentication that i not use. No solution found also in smit menu... Thanks for your help. (2 Replies)
Discussion started by: feilong
2 Replies

6. AIX

Limitation for SFTP on AIX number of sessions

Hello. I am using AIX 6 and If wish to receive more than 500 files via SFTP, I get some time out errors. Could you please advise where is the limit for number of concurrent transfers setup in AIX Box or what is the limit and can that be changed? Many Thanks (3 Replies)
Discussion started by: panchpan
3 Replies

7. UNIX for Dummies Questions & Answers

Limitation in addition

whats wrong with this addition? Whats the maximum number of digits can be handled? pandeeswaran@ubuntu:~/Downloads$ const=201234454654768979799999 pandeeswaran@ubuntu:~/Downloads$ let new+=const pandeeswaran@ubuntu:~/Downloads$ echo $new -2152890657037557890 pandeeswaran@ubuntu:~/Downloads$ (4 Replies)
Discussion started by: pandeesh
4 Replies

8. AIX

What is the limitation in AIX?

Hi All, i got few questions... 1) What is the maximum number of files that we can save under a single directory in AIX ? (* we have enough storage/disk space) 2) And what is the maximum number of sub - directories in side a directory? I know that...every directory is a (special)... (11 Replies)
Discussion started by: System Admin 77
11 Replies

9. Shell Programming and Scripting

sed 255 Character Limitation

Hello, I am using sed command to place a comma dynamically in certain positions. When the position variable exceeds 255 characters, it errors out. I would appreciate if someone can point in the correct direction sed 's/^\(.\{'"$pos"'\}\)./\1,/' ragha.txt > ragha3.txt If $pos > 255,... (8 Replies)
Discussion started by: ragha81
8 Replies

10. AIX

AIX lpar bad disk I/O performance - 4k per IO limitation ?

Hi Guys, I have fresh new installed VIO 2.2.3.70 on a p710, 3 physical SAS disks, rootvg on hdisk0 and 3 VIO clients through vscsi, AIX7.1tl4 AIX6.1tl9 RHEL6.5ppc, each lpar has its rootvg installed on a LV on datavg (hdisk2) mapped to vhost0,1,2 There is no vg on hdisk1, I use it for my... (1 Reply)
Discussion started by: frenchy59
1 Replies
SHCOMP(1)						    User Environment Utilities							 SHCOMP(1)

NAME
shcomp - compile a ksh93 shell script SYNOPSIS
shcomp [ options ] [infile] [outfile]] ORIGIN OF THIS MAN PAGE
This man page was written by Christophe Martin <Schplurtz@free.fr> for the Debian GNU/Linux system. It is based on "shcomp --man" output. DESCRIPTION
Unless -D is specified, shcomp takes a shell script, infile, and creates a binary format file, outfile, that ksh93 can read and execute with the same effect as the original script. Since aliases are processed as the script is read, alias definitions whose value requires variable expansion will not work correctly. If -D is specified, all double quoted strings that are preceded by $ are output. These are the messages that need to be translated to locale specific versions for internationalization. If outfile is omitted, then the results will be written to standard output. If infile is also omitted, the shell script will be read from standard input. OPTIONS
-D, --dictionary Generate a list of strings that need to be placed in a message catalog for internationalization. -n, --noexec Displays warning messages for obsolete or non-conforming constructs. -v, --verbose Displays input from infile onto standard error as it reads it. --man Displays this man page on standard error and exits. --help Shows a short help message and exits. EXIT STATUS
0 Successful completion. >0 An error occurred. DEBIAN WARNING
On a Debian GNU/Linux system, more than one package may provide ksh. the output of shcomp can only be used by ksh93. Any other ksh will be unable to run the compiled script. EXAMPLE
( echo '#! /bin/ksh93' ; shcomp myscript ) > myscript.bin && chmod 755 myscript.bin ./myscript.bin SEE ALSO
ksh(1) IMPLEMENTATION
version shcomp (AT&T Labs Research) 2003-03-02 author David Korn <dgk@research.att.com> copyright Copyright (c) 1982-2005 AT&T Corp. license http://www.opensource.org/licenses/cpl1.0.txt KSH93 Fri Jun 3 2005 SHCOMP(1)
All times are GMT -4. The time now is 12:14 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy