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
Msgcat(3pm)						User Contributed Perl Documentation					       Msgcat(3pm)

NAME
Locale::Msgcat - Perl extension for blah blah blah SYNOPSIS
use Locale::Msgcat; $cat = new Locale::Msgcat; $rc = $cat->catopen(name, oflag); $msg = $cat->catgets(set_number, message_number, string); $rc = $cat->catclose(); DESCRIPTION
The Locale::Msgcat module allows access to the message catalog functions which are available on some systems. A new Locale::Msgcat object must first be created for each catalog which has to be open at a given time. The catopen operation opens the catalog whose name is given as argument. The oflag can be either 0 or NL_CAT_LOCALE (usually 1) which is the recommended value. The catgets message retrieves message_number for the set_number message set, and if not found returns string. The catclose function should be used when access to a catalog is not needed anymore. EXAMPLES
use Locale::Msgcat; $cat = new Locale::Msgcat; unless ($cat->catopen("whois.cat", 1)) { print STDERR "Can't open whois catalog. "; exit(1); } printf "First message, first set : %s ", $cat->catgets(1, 1, "not found"); unless ($cat->catclose()) { print STDERR "Can't close whois catalog. "; exit(1); } The above example would print the first message from the first message set found in the whois catalog, or if not found it would print "not found". AUTHOR
Christophe Wolfhugel, wolf@pasteur.fr SEE ALSO
catopen(3), catclose(3), catgets(3), perl(1). perl v5.14.2 1999-11-15 Msgcat(3pm)
All times are GMT -4. The time now is 07:10 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy