Sponsored Content
Full Discussion: Length of each line.
Top Forums Shell Programming and Scripting Length of each line. Post 302229829 by dennis.jacob on Thursday 28th of August 2008 04:30:45 AM
Old 08-28-2008
Apply the logic :

Code:
awk '{
 if (!(/^1010/ && length($1)==132)) print NF" "$0>>"/tmp/file_out" ;
 if (!(/^9142/ && length($1)==41)) print NF" "$0>>"/tmp/file_out" ;
 if (!(/^1011/ && length($1)==250)) print NF" "$0>>"/tmp/file_out" ;
 if (!(/^9999/ && length($1)==70)) print NF" "$0>>"/tmp/file_out" ;
 }'  filename

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

grep line length limit

Hi Friends, I am having a funny problem with grep. When I run grep 'expr' file.txt things work fine. But when try to get the line number using the -n option, i.e, grep -n 'expr' file.txt I get a message, "grep: 0652-226 Maximum line length of 2048 exceeded." If the line has more than... (3 Replies)
Discussion started by: hnhegde
3 Replies

2. Shell Programming and Scripting

line length

hi In my script i am having echoes which have very lage output. echo $final sample output: etc... The output gets printed continuosly. Is there any way by which I can put a line break after every 25 positions? In nutshell , I need a neat output of my BIG echo as below: (4 Replies)
Discussion started by: Sreejith_VK
4 Replies

3. Shell Programming and Scripting

Deleting Characters at specific position in a line if the line is certain length

I've got a file that would have lines similar to: 12345678 x.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 23456781 x.00 xx.00 xx.00 xx.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 34567812 x.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 45678123 x.00 xx.00 xx.00 xx.00 xx.00 x.00 xxx.00 xx.00 xx.00 xx.00 xx.00... (10 Replies)
Discussion started by: Cailet
10 Replies

4. Shell Programming and Scripting

separate file by line length

hi all, i'm new in unix.... i have question, sorry if it's missplace or too silly let say i have a file name testfile.log that contains data 000001 000002 000003 aaaaaaaaaaaaaaaaaa bbbbbbbbbbbbbbbbbbbb cccccccccccccc dddddddddddddddddd 000004 i want to make new file... (3 Replies)
Discussion started by: venven
3 Replies

5. Shell Programming and Scripting

Parse a line which has different word length

Hi All, Please let me know a command to parse the below line and find the words, I have a line like this 40609 39930 In this above line the two words are separted by space.The length of this two words may differ. I want to put 40609 in var_one and 39930 in var_two. Eg. Input line is ... (1 Reply)
Discussion started by: girish.raos
1 Replies

6. Shell Programming and Scripting

Count line Length

I am trying to write a shell scrip that can give me the line length of a record that was in EBDIC and then converted to ASCII. Everything I try reports 1 yet the length is 2000+. I have tried echo "Line length : ${#FILE}" echo "FILE" |awk -F, '{print NF}' awk '{lenth(file)}' All I can... (11 Replies)
Discussion started by: wbshrk
11 Replies

7. Programming

Is there a limit for a code line length in C?

Is there any stabdard limitation on size of a code line in C code? I am interesting in UNIX limitation, particulary on SUN. Thanks! (8 Replies)
Discussion started by: alex_5161
8 Replies

8. Shell Programming and Scripting

Check for length which exceeds specified length in a line

Hi, I have a issue, I need to loop through a comma delimited file and check for the length which exceeds specified length , if Yes truncate the string. But my problem is , I do not have to check for all the fields and the field lenght is not same for all the fields. For ex: Say my line... (9 Replies)
Discussion started by: rashmisb
9 Replies

9. Programming

Maximum length of a line

How can I change the maximum length of a programming line in fortran and C (specifically in fortran 77)? Seems the default maximum length is 72 in fortran 77. Thanks. (4 Replies)
Discussion started by: hbar
4 Replies

10. OS X (Apple)

Vim line length...

The vi(m) text editor... Google is not my friend here... I have already found out that it is possible to save a pure text file without the '0x0A' newline character at the very end of the file but I can't find anything on the next question. I have written a raw audio file to quantised pure... (6 Replies)
Discussion started by: wisecracker
6 Replies
tconv(1)							       HP-UX								  tconv(1)

NAME
tconv - HP 9000 Traditional-Chinese code converter SYNOPSIS
tconv tconv 1 tconv 1 num infile outfile tconv 1 -n num -f file_of_namelist tconv 2 [-r] [-ps] [-rs number] -m method -i infile -o outfile tconv 3 tconv 3 num infile outfile tconv 3 -n num -f file_of_namelist tconv 4 tconv 4 num infile outfile tconv 4 -n num -f file_of_namelist tconv 5 tconv 5 num infile outfile tconv 5 -n num -f file_of_namelist DESCRIPTION
tconv is a code converter to do code conversion from CCDC/Big5/EUC-CNS(locale: zh_TW.ccdc/zh_TW.big5/zh_TW.eucTW) internal code to another local Taiwanese 2-byte or 3-byte Traditional-Chinese internal code, or to Unicode in UCS2 or UTF8 format; as well the conversion of Big5 code(Traditional-Chinese) to GB code(Simplified-Chinese) (locale:zh_CN.hp15CN) or GBK code. It provides fourteen processing modes. Mode (1) : tconv The first one is an interactive menu mode. Just invoke the command. It will display the main menu, and prompt you for which kind of code conversion you need(whether it is between 2-byte and 2-byte, 3-byte and 2-byte, 4-byte and 2-byte, Traditional-Chinese code and Sim- plified-Chinese code or even Unicode). After you choose, if it's 2-byte and 2-byte, it will display the 2-byte code code conversion sub- menu and prompt you what type of code conversion you need and then ask you your input filename and output filename. If it's 3-byte and 2-byte, it will show the usage of it and ends. If it's 4-byte and 2-byte, it will display the 4-byte code code conversion sub-menu and prompt you what type of code conversion you need and then ask you your input filename and output filename. And then, if it's Traditional- Chinese and Simplified-Chinese, it will display the Traditional-Chinese and Simplified-Chinese code code-conversion sub-menu and prompt you what type of code conversion you need and then ask you your input filename and output filename. Finally, if it is Unicode, it will display the Unicode code conversion sub-menu and prompt you what type of code conversion you need and then ask you your input and output filenames. Mode (2) : tconv 1 The second is also a menu mode. If you invoke the command. It will go directly to the 2-byte code code conversion sub-menu. Mode (3) : tconv 1 num infile outfile The third is used to convert one 2-byte code text file to another code type text file in command mode. The infile stands for the input filename, outfile for output filename. And num is the selection number you can find out from the interactive menu mode. Below is the description of them : num = 1 : From HP Big5 code to IBM 5550 code. 2 : From HP Big5 code to CDC code. 3 : From HP Big5 code to National Standard code. 4 : From HP Big5 code to HP CCDC code. 5 : From HP Big5 code to Shift-Big5 code. 6 : From HP Big5 code to Taipei Computer Association code. 7 : From HP Big5 code to Tien-Lon code. 8 : From HP CCDC code to IBM 5550 code. 9 : From HP CCDC code to ETen code. 10 : From HP CCDC code to National Standard code. 11 : From HP CCDC code to Shift-Big5 code. 12 : From HP CCDC code to Taipei Computer Association code. 13 : From HP CCDC code to HP VECTRA PC code. 14 : From HP CCDC code to 2-byte WANG PC code. 15 : From Tandem internal code to HP CCDC code. 16 : From IBM 5550 code to HP Big5 code. 17 : From CDC code to HP Big5 code. 18 : From National Standard code to HP Big5 code. 19 : From HP CCDC code to HP Big5 code. 20 : From Shift-Big5 code to HP Big5 code. 21 : From Taipei Computer Assocoation code to HP Big5 code. 22 : From Tien-Lon code to HP Big5 code. 23 : From IBM 5550 code to HP CCDC code. 24 : From ETen code to HP CCDC code. 25 : From National Standard code to HP CCDC code. 26 : From Shift-Big5 code to HP CCDC code. 27 : From Taipei Computer Association code to HP CCDC code. 28 : From HP VECTRA PC code to HP CCDC code. 29 : From 2-byte WANG PC code to HP CCDC code. 30 : From HP CCDC code to Tandem internal code. Mode (4) : tconv 1 -n num -f file_of_namelist The fourth is used to convert many files with one tconv 1 command. You have to create a file with all the filenames you want to convert. Let the file name be file_of_namelist , and the format of the file is : <file1> <file2> <file3> . . . <EOF> Then use the command to convert all those files in batch mode. Also, same as Mode (3), num is the selection number you can find from the interactive menu mode. Notice that you can only do one kind of conversion to all the files in file_of_namelist , and there is no output filenames, all the files will be put into original file names which you specify in file_of_namelist. Mode (5) : tconv 2 [-r] [-ps] [-rs number] -m method -i infile -o outfile The fifth is the command tconv 2 , it is for code conversion between WANG's 3-byte internal code and HP's CCDC or Big5 code. It only supports batch mode procssing. Each tconv 2 command will convert one text file. Options Options for tconv 2 are interpreted as follows: -r this option means fixed record length. Default is free format. This option is useful to text file. -rs number this option is used to specify the record size of the file. For example '-rs 80' means that the record size is 80. The range of number is between 0 and 10240. -ps while converting from WANG to CCDC or Big5. Each 3-byte code will be converted to one 2-byte code and one 1-byte space. It implies fixed record length. -m wang_hp convert from WANG's 3-byte code to HP's 2-byte CCDC code -m wang_big5 convert from WANG's 3-byte code to 2-byte Big5 code -m hp_wang convert from HP's 2-byte CCDC code to WANG's 3-byte code -m big5_wang convert from 2-byte Big5 code to WANG's 3-byte code -i infile specify the input text file name -o outfile specify the output text file name Mode (6) : tconv 3 The sixth mode is also a menu mode. If you invoke the tconv 3 command. It will go directly to the 4-byte code code conversion sub- menu. The description is as follow : (1). From 4-byte Extended Unit Code(EUC) to HP Big5 code. (2). From 4-byte Extended Unit Code(EUC) to HP CCDC code. (3). From EUC to New Host Code(Traditional Chinese EBCDIC). (4). From HP Big5 code to 4-byte Extended Unit Code(EUC). (5). From HP CCDC code to 4-byte Extended Unit Code(EUC). (6). From New Host Code(Traditional Chinese EBCDIC) to EUC. Mode (7) : tconv 3 num infile outfile The seventh is used to convert one 4-byte code text file to another code type text file in command mode. The infile stands for the input filename, outfile for output filename. And num is the selection number you can find out from the interactive menu mode. Below is the description of them : num = 1 : From 4-byte Extended Unit Code(EUC) to HP Big5 code. 2 : From 4-byte Extended Unit Code(EUC) to HP CCDC code. 3 : From EUC to New Host Code(Traditional Chinese EBCDIC). 4 : From HP Big5 code to 4-byte Extended Unit Code(EUC). 5 : From HP CCDC code to 4-byte Extended Unit Code(EUC). 6 : From New Host Code(Traditional Chinese EBCDIC) to EUC. Mode (8) : tconv 3 -n num -f file_of_namelist The eighth is used to convert many files with one tconv 3 command. You have to create a file with all the filenames you want to con- vert. Let the file name be file_of_namelist , and the format of the file is : <file1> <file2> <file3> . . . <EOF> Then use the command to convert all those files in batch mode. Also, same as Mode (7), num is the selection number you can find from the interactive menu mode. Notice that you can only do one kind of conversion to all the files in file_of_namelist , and there is no output filenames, all the files will be put into original file names which you specify in file_of_namelist. Mode (9) : tconv 4 The ninth mode is a menu mode too. If you invoke the tconv 4 command. It will go directly to the Traditional-Chinese and Simplified- Chinese code-conversion sub-menu. The description is as follow : (1). From HP Big5 code to HP GB code. (2). From HP Big5 code to GBK code. (3). From HP GB code to HP Big5 code. (4). From GBK code to HP Big5 code. Mode (10) : tconv 4 num infile outfile The tenth is used to convert one Big5 or GB code text file to the other code type text file in command mode. The infile stands for the input filename, outfile for output filename. And num is the selection number you can find out from the interactive menu mode. Below is the description of them : num = 1 : From Big5 code to GB code. 2 : From Big5 code to GBK code. 3 : From GB code to Big5 code. 4 : From GBK code to Big5 code. Mode (11) : tconv 4 -n num -f file_of_namelist The eleventh is used to convert many files with one tconv 4 command. You have to create a file with all the filenames you want to convert. Let the file name be file_of_namelist , and the format of the file is : <file1> <file2> <file3> . . . <EOF> Then use the command to convert all those files in batch mode. Also, same as Mode (10), num is the selection number you can find from the interactive menu mode. Notice that you can only do one kind of conversion to all the files in file_of_namelist , and there is no output filenames, all the files will be put into original file names which you specify in file_of_namelist. Mode (12) : tconv 5 The twelfth mode is a menu mode too. If you invoke the tconv 5 command. It will go directly to the Unicode code-conversion sub-menu. The description is as follow : ( 1). From HP Big5 code to Unicode's Canonical Form(UCS2). ( 2). From HP EUC code to Unicode's Canonical Form(UCS2). ( 3). From HP CCDC code to Unicode's Canonical Form(UCS2). ( 4). From Unicode's Canonical Form(UCS2) to HP Big5 code. ( 5). From Unicode's Canonical Form(UCS2) to HP EUC code. ( 6). From Unicode's Canonical Form(UCS2) to HP CCDC code. ( 7). From HP Big5 code to Universal Trans. Format-8(UTF8). ( 8). From HP EUC code to Universal Trans. Format-8(UTF8). ( 9). From HP CCDC code to Universal Trans. Format-8(UTF8). (10). From Universal Trans. Format-8(UTF8) to HP Big5 code. (11). From Universal Trans. Format-8(UTF8) to HP EUC code. (12). From Universal Trans. Format-8(UTF8) to HP CCDC code. Mode (13) : tconv 5 num infile outfile The thirteenth is used to convert one Unicode code text file to the other code type text file in command mode. The infile stands for the input filename, outfile for output filename. And num is the selection number you can find out from the interactive menu mode. Below is the description of them : num = 1 : From HP Big5 code to Unicode's Canonical Form(UCS2). 2 : From HP EUC code to Unicode's Canonical Form(UCS2). 3 : From HP CCDC code to Unicode's Canonical Form(UCS2). 4 : From Unicode's Canonical Form(UCS2) to HP Big5 code. 5 : From Unicode's Canonical Form(UCS2) to HP EUC code. 6 : From Unicode's Canonical Form(UCS2) to HP CCDC code. 7 : From HP Big5 code to Universal Trans. Format-8(UTF8). 8 : From HP EUC code to Universal Trans. Format-8(UTF8). 9 : From HP CCDC code to Universal Trans. Format-8(UTF8). 10 : From Universal Trans. Format-8(UTF8) to HP Big5 code. 11 : From Universal Trans. Format-8(UTF8) to HP EUC code. 12 : From Universal Trans. Format-8(UTF8) to HP CCDC code. Mode (14) : tconv 5 -n num -f file_of_namelist The fourteenth is used to convert many files with one tconv 5 command. You have to create a file with all the filenames you want to convert. Let the file name be file_of_namelist , and the format of the file is : <file1> <file2> <file3> . . . <EOF> Then use the command to convert all those files in batch mode. Also, same as Mode (13), num is the selection number you can find from the interactive menu mode. Notice that you can only do one kind of conversion to all the files in file_of_namelist , and there is no output filenames, all the files will be put into original file names which you specify in file_of_namelist. EXAMPLE
tconv 1 4 file_in file_out , converts a text file from Big5 to CCDC tconv 1 -n 4 -f file_list , converts all the files in file_list from Big5 to CCDC tconv 2 -m wang_big5 -i file_in -o file_out , converts a text file from WANG to Big5 tconv 2 -r -m wang_big5 -i file_in -o file_out , converts a text file from WANG to Big5 and retain the record length tconv 2 -ps -m wang_big5 -i file_in -o file_out , converts a text file from WANG to Big5, pad space at each character tconv 2 -rs 80 -m wang_big5 -i file_in -o file_out , converts a text file from WANG to Big5, record size is 80. tconv 3 4 file_in file_out , converts a text file from Big5 to EUC tconv 3 -n 4 -f file_list , converts all the files in file_list from Big5 to EUC tconv 4 1 file_in file_out , converts a text file from Big5 to GB tconv 4 -n 1 -f file_list , converts all the files in file_list from Big5 to GB tconv 5 1 file_in file_out , converts a text file from Big5 to Unicode(UCS2) tconv 5 -n 1 -f file_list , converts all the files in file_list from Big5 to Unicode(UCS2) NOTICE
By default, tconv maps non-mapped characters to spaces. LOG FILE
/tmp/tconv.log AUTHOR
tconv was developed by AAA/TC-ESG, HP Taiwan. tconv(1)
All times are GMT -4. The time now is 06:47 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy