Sponsored Content
Top Forums Shell Programming and Scripting Setting the number of fields using awk Post 302998903 by gull04 on Friday 9th of June 2017 10:56:59 AM
Old 06-09-2017
Hi Rudi,

You're almost correct, hidden away in the file was the following;

Code:
[davem@deneb data]$ dos2unix < out_file_01.txt > out_file_02.txt
dos2unix: Binary symbol 0x00 found at line 5560351
dos2unix: Skipping binary file stdin
[davem@deneb data]$ vi out_file_01.txt
[davem@deneb data]$ dos2unix < out_file_01.txt > out_file_02.txt
[davem@deneb data]$ head out_file_02.txt | awk -F"," '{NF=35}1' OFS=","
N1000,024,2809003,,,3,DYNAMIC AVLEASE INC,PO BOX 7,,BRIDGEWATER,VA,22812-0007,1,165,US,20090520,20090520,,5,2,V,50003414,,,,,,,,,,,,,
N1000,024,2809003,52215,1985,3,DYNAMIC AVLEASE INC,PO BOX 7,,BRIDGEWATER,VA,22812-0007,1,165,US,20090520,20090520,1T,5,2,V,50003414,,20090602,,,,,,,,,,,
N1000,024,2809003,52215,1985,3,DYNAMIC AVLEASE INC,PO BOX 7,,BRIDGEWATER,VA,22812-0007,1,165,US,20090520,20090520,32,5,2,14,50003414,,20091118,,,,,,20110930,,,,,
N1000,024,2809003,52215,1985,3,DYNAMIC AVLEASE INC,PO BOX 7,,BRIDGEWATER,VA,22812-0007,1,165,US,20090520,20090520,32,5,2,V,50003414,,20091118,,,,,,,,,,,
N1000,024,2809003,52215,1985,3,DYNAMIC AVLEASE INC,PO BOX 7,,BRIDGEWATER,VA,22812-0007,1,165,US,20090520,20090520,32,5,2,V,50003414,,20091118,,,,,,20110930,,,,,
N1000,024,2809003,52215,1985,3,DYNAMIC AVLEASE INC,PO BOX 7,,BRIDGEWATER,VA,228120007,1,165,US,20110411,20090520,1T,5,2,25,50003414,,20130711,,,,,,20140430,01032549,,,A0070C,
N1000,024,2809003,52215,1985,3,DYNAMIC AVLEASE INC,PO BOX 7,,BRIDGEWATER,VA,228120007,1,165,US,20110411,20090520,1T,5,2,V,50003414,,20130711,,,,,,20140430,01032549,,,A0070C,
N1000,024,2809003,52215,1985,3,DYNAMIC AVLEASE INC,PO BOX 7,,BRIDGEWATER,VA,22812-0007,1,165,US,20110411,20090520,32,5,2,V,50003414,,20091118,,,,,,20140430,,,,,
N1000,024,2809003,52215,1985,3,DYNAMIC AVLEASE INC,PO BOX 7,,BRIDGEWATER,VA,22812-0007,1,165,US,20110411,20090520,32,5,2,V,50003414,,20091118,,,,,,20140430,01032549,,,,
N1000,024,2809003,52215,1985,3,DYNAMIC AVLEASE INC,PO BOX 7,,BRIDGEWATER,VA,228120007,1,165,US,20110411,20090520,41,5,2,V,50003414,,20111201,,,,,,20140430,01032549,,,,
[davem@deneb data]$ 

Such is life, I was sure that I'd already ran dos2unix on it - but it would seem not - I hate the way that vi now suppresses the control characters.

Anyway many thanks to everyone for the assistance.

Regards

Gull04

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk sed cut? to rearrange random number of fields into 3 fields

I'm working on formatting some attendance data to meet a vendors requirements to upload to their system. With some help on the forums here, I have the data close. But they've since changed what they want. The vendor wants me to submit three fields to them. Field 1 is the studentid field,... (4 Replies)
Discussion started by: axo959
4 Replies

2. UNIX for Dummies Questions & Answers

count number of fields not using SED or AWK

hi forums i need help with a little problem i am having. i need to count the number of fields that are in a saved variable so i can use that number to make a different function work properly. is there a way of doing this without using SED/AWK? anything would be greatly appreciated (4 Replies)
Discussion started by: strasner
4 Replies

3. Shell Programming and Scripting

Number of fields handled by awk

Hi Gurus, Have a file seperated by "~" and no of fields is 104. When i try to run awk, it erros out. awk: record `B~A31~T24_STF~~~2009...' has too many fields Any idea how can i extract a specific filed with this many fields in a row. Kindly help (3 Replies)
Discussion started by: srivat79
3 Replies

4. Shell Programming and Scripting

How to (n)awk lines of CSV with certain number of fields?

I have a CSV file with a variable number of fields per record. How do I print lines of a certain number of fields only? Several permutations of the following (including the use of escape characters) have failed to retrieve the line I'm after (1,2,3,4)... $ cat myfile 1,2,3,4 1,2,3 $ # Print... (1 Reply)
Discussion started by: cs03dmj
1 Replies

5. Shell Programming and Scripting

awk split lines without knowing the number of fields a-priori

I want to use awk to split fields and put them into a file but I don't know the number of fields for example, in the following line Ports: 22/filtered/tcp//ssh///, 53/open/tcp//tcpwrapped///, 111/filtered/tcp//rpcbind///, 543/filtered/tcp//klogin///, 544/filtered/tcp//kshell///,... (3 Replies)
Discussion started by: esolvepolito
3 Replies

6. Shell Programming and Scripting

[ksh88 and awk] Number of fields with a value.

Hi, With: # VALUES="one~two~~~" # echo $VALUES | awk 'BEGIN {FS="~"} {print NF}' 5 I can determine the number of fields. How to determine the number of fields with a value ? In this case 2. Thanks in advance, ejdv (6 Replies)
Discussion started by: ejdv
6 Replies

7. Shell Programming and Scripting

awk processing of variable number of fields data file

Hy! I need to post-process some data files which have variable (and periodic) number of fields. For example, I need to square (data -> data*data) the folowing data file: -5.34281E-28 -3.69822E-29 8.19128E-29 9.55444E-29 8.16494E-29 6.23125E-29 4.42106E-29 2.94592E-29 1.84841E-29 ... (5 Replies)
Discussion started by: radudownload
5 Replies

8. UNIX for Dummies Questions & Answers

Make all records with the same number of fields (awk)

Hi, input: AA|BB|CC DD|EE FF what I am trying to get: AA|BB|CC DD|EE| FF|| I tried to create first an UDF for printing repeats, but I think I have an issue with my END section or my array: function repeat(str, n, rep, i) { for(i=1 ;i<n;i++) rep=rep str return rep } ... (6 Replies)
Discussion started by: beca123456
6 Replies

9. Shell Programming and Scripting

Awk: Combine multiple lines based on number of fields

If a file has following kind of data, comma delimited 1,2,3,4 1 1 1,2,3,4 1,2 2 2,3,4 My required output must have only 4 columns with comma delimited 1,2,3,4 111,2,3,4 1,222,3,4 I have tried many awk command using ORS="" but couldnt progress (10 Replies)
Discussion started by: mdkm
10 Replies

10. UNIX for Beginners Questions & Answers

Is there a UNIX command that can compare fields of files with differing number of fields?

Hi, Below are the sample files. x.txt is from an Excel file that is a list of users from Windows and y.txt is a list of database account. $ head -500 x.txt y.txt ==> x.txt <== TEST01 APP_USER_PROFILE USER03 APP_USER_PROFILE TEST02 APP_USER_EXP_PROFILE TEST04 APP_USER_PROFILE USER01 ... (3 Replies)
Discussion started by: newbie_01
3 Replies
KOI8-U(7)						     Linux Programmer's Manual							 KOI8-U(7)

NAME
koi8-u - Ukrainian character set encoded in octal, decimal, and hexadecimal DESCRIPTION
RFC 2310 defines an 8-bit character set, KOI8-U. KOI8-U encodes the characters used in Ukrainian and Byelorussian. KOI8-U characters The following table displays the characters in KOI8-U that are printable and unlisted in the ascii(7) manual page. Oct Dec Hex Char Description ----------------------------------------------------------------------- 200 128 80 BOX DRAWINGS LIGHT HORIZONTAL 201 129 81 | BOX DRAWINGS LIGHT VERTICAL 202 130 82 BOX DRAWINGS LIGHT DOWN AND RIGHT 203 131 83 BOX DRAWINGS LIGHT DOWN AND LEFT 204 132 84 BOX DRAWINGS LIGHT UP AND RIGHT 205 133 85 BOX DRAWINGS LIGHT UP AND LEFT 206 134 86 BOX DRAWINGS LIGHT VERTICAL AND RIGHT 207 135 87 BOX DRAWINGS LIGHT VERTICAL AND LEFT 210 136 88 BOX DRAWINGS LIGHT DOWN AND HORIZONTAL 211 137 89 BOX DRAWINGS LIGHT UP AND HORIZONTAL 212 138 8A BOX DRAWINGS LIGHT VERTICAL AND HORIZONTAL 213 139 8B UPPER HALF BLOCK 214 140 8C LOWER HALF BLOCK 215 141 8D FULL BLOCK 216 142 8E LEFT HALF BLOCK 217 143 8F RIGHT HALF BLOCK 220 144 90 LIGHT SHADE 221 145 91 MEDIUM SHADE 222 146 92 DARK SHADE 223 147 93 TOP HALF INTEGRAL 224 148 94 BLACK SQUARE 225 149 95 BULLET OPERATOR 226 150 96 / SQUARE ROOT 227 151 97 ~~ ALMOST EQUAL TO 230 152 98 <= LESS-THAN OR EQUAL TO 231 153 99 >= GREATER-THAN OR EQUAL TO 232 154 9A NO-BREAK SPACE 233 155 9B BOTTOM HALF INTEGRAL 234 156 9C o DEGREE SIGN 235 157 9D 2 SUPERSCRIPT TWO 236 158 9E . MIDDLE DOT 237 159 9F -:- DIVISION SIGN 240 160 A0 BOX DRAWINGS DOUBLE HORIZONTAL 241 161 A1 BOX DRAWINGS DOUBLE VERTICAL 242 162 A2 BOX DRAWINGS DOWN SINGLE AND RIGHT DOUBLE 243 163 A3 CYRILLIC SMALL LETTER IO 244 164 A4 CYRILLIC SMALL LETTER UKRAINIAN IE 245 165 A5 BOX DRAWINGS DOUBLE DOWN AND RIGHT 246 166 A6 CYRILLIC SMALL LETTER BYELORUSSIAN-UKRAINIAN I 247 167 A7 CYRILLIC SMALL LETTER YI (Ukrainian) 250 168 A8 BOX DRAWINGS DOUBLE DOWN AND LEFT 251 169 A9 BOX DRAWINGS UP SINGLE AND RIGHT DOUBLE 252 170 AA BOX DRAWINGS UP DOUBLE AND RIGHT SINGLE 253 171 AB BOX DRAWINGS DOUBLE UP AND RIGHT 254 172 AC BOX DRAWINGS UP SINGLE AND LEFT DOUBLE 255 173 AD CYRILLIC SMALL LETTER GHE WITH UPTURN 256 174 AE BOX DRAWINGS DOUBLE UP AND LEFT 257 175 AF BOX DRAWINGS VERTICAL SINGLE AND RIGHT DOUBLE 260 176 B0 BOX DRAWINGS VERTICAL DOUBLE AND RIGHT SINGLE 261 177 B1 BOX DRAWINGS DOUBLE VERTICAL AND RIGHT 262 178 B2 BOX DRAWINGS VERTICAL SINGLE AND LEFT DOUBLE 263 179 B3 CYRILLIC CAPITAL LETTER IO 264 180 B4 CYRILLIC CAPITAL LETTER UKRAINIAN IE 265 181 B5 BOX DRAWINGS DOUBLE VERTICAL AND LEFT 266 182 B6 CYRILLIC CAPITAL LETTER BYELORUSSIAN-UKRAINIAN I 267 183 B7 CYRILLIC CAPITAL LETTER YI (Ukrainian) 270 184 B8 BOX DRAWINGS DOUBLE DOWN AND HORIZONTAL 271 185 B9 BOX DRAWINGS UP SINGLE AND HORIZONTAL DOUBLE 272 186 BA BOX DRAWINGS UP DOUBLE AND HORIZONTAL SINGLE 273 187 BB BOX DRAWINGS DOUBLE UP AND HORIZONTAL 274 188 BC BOX DRAWINGS VERTICAL SINGLE AND HORIZONTAL DOUBLE 275 189 BD CYRILLIC CAPITAL LETTER GHE WITH UPTURN 276 190 BE BOX DRAWINGS DOUBLE VERTICAL AND HORIZONTAL 277 191 BF (C) COPYRIGHT SIGN 300 192 C0 CYRILLIC SMALL LETTER YU 301 193 C1 CYRILLIC SMALL LETTER A 302 194 C2 CYRILLIC SMALL LETTER BE 303 195 C3 CYRILLIC SMALL LETTER TSE 304 196 C4 CYRILLIC SMALL LETTER DE 305 197 C5 CYRILLIC SMALL LETTER IE 306 198 C6 CYRILLIC SMALL LETTER EF 307 199 C7 CYRILLIC SMALL LETTER GHE 310 200 C8 CYRILLIC SMALL LETTER HA 311 201 C9 CYRILLIC SMALL LETTER I 312 202 CA CYRILLIC SMALL LETTER SHORT I 313 203 CB CYRILLIC SMALL LETTER KA 314 204 CC CYRILLIC SMALL LETTER EL 315 205 CD CYRILLIC SMALL LETTER EM 316 206 CE CYRILLIC SMALL LETTER EN 317 207 CF CYRILLIC SMALL LETTER O 320 208 D0 CYRILLIC SMALL LETTER PE 321 209 D1 CYRILLIC SMALL LETTER YA 322 210 D2 CYRILLIC SMALL LETTER ER 323 211 D3 CYRILLIC SMALL LETTER ES 324 212 D4 CYRILLIC SMALL LETTER TE 325 213 D5 CYRILLIC SMALL LETTER U 326 214 D6 CYRILLIC SMALL LETTER ZHE 327 215 D7 CYRILLIC SMALL LETTER VE 330 216 D8 CYRILLIC SMALL LETTER SOFT SIGN 331 217 D9 CYRILLIC SMALL LETTER YERU 332 218 DA CYRILLIC SMALL LETTER ZE 333 219 DB CYRILLIC SMALL LETTER SHA 334 220 DC CYRILLIC SMALL LETTER E 335 221 DD CYRILLIC SMALL LETTER SHCHA 336 222 DE CYRILLIC SMALL LETTER CHE 337 223 DF CYRILLIC SMALL LETTER HARD SIGN 340 224 E0 CYRILLIC CAPITAL LETTER YU 341 225 E1 CYRILLIC CAPITAL LETTER A 342 226 E2 CYRILLIC CAPITAL LETTER BE 343 227 E3 CYRILLIC CAPITAL LETTER TSE 344 228 E4 CYRILLIC CAPITAL LETTER DE 345 229 E5 CYRILLIC CAPITAL LETTER IE 346 230 E6 CYRILLIC CAPITAL LETTER EF 347 231 E7 CYRILLIC CAPITAL LETTER GHE 350 232 E8 CYRILLIC CAPITAL LETTER HA 351 233 E9 CYRILLIC CAPITAL LETTER I 352 234 EA CYRILLIC CAPITAL LETTER SHORT I 353 235 EB CYRILLIC CAPITAL LETTER KA 354 236 EC CYRILLIC CAPITAL LETTER EL 355 237 ED CYRILLIC CAPITAL LETTER EM 356 238 EE CYRILLIC CAPITAL LETTER EN 357 239 EF CYRILLIC CAPITAL LETTER O 360 240 F0 CYRILLIC CAPITAL LETTER PE 361 241 F1 CYRILLIC CAPITAL LETTER YA 362 242 F2 CYRILLIC CAPITAL LETTER ER 363 243 F3 CYRILLIC CAPITAL LETTER ES 364 244 F4 CYRILLIC CAPITAL LETTER TE 365 245 F5 CYRILLIC CAPITAL LETTER U 366 246 F6 CYRILLIC CAPITAL LETTER ZHE 367 247 F7 CYRILLIC CAPITAL LETTER VE 370 248 F8 CYRILLIC CAPITAL LETTER SOFT SIGN 371 249 F9 CYRILLIC CAPITAL LETTER YERU 372 250 FA CYRILLIC CAPITAL LETTER ZE 373 251 FB CYRILLIC CAPITAL LETTER SHA 374 252 FC CYRILLIC CAPITAL LETTER E 375 253 FD CYRILLIC CAPITAL LETTER SHCHA 376 254 FE CYRILLIC CAPITAL LETTER CHE 377 255 FF CYRILLIC CAPITAL LETTER HARD SIGN NOTES
The differences from KOI8-R are in the hex positions A4, A6, A7, AD, B4, B6, B7, and BD. SEE ALSO
ascii(7), charsets(7), cp1251(7), iso_8859-5(7), koi8-r(7), utf-8(7) COLOPHON
This page is part of release 4.15 of the Linux man-pages project. A description of the project, information about reporting bugs, and the latest version of this page, can be found at https://www.kernel.org/doc/man-pages/. Linux 2016-07-17 KOI8-U(7)
All times are GMT -4. The time now is 11:51 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy