Sponsored Content
Full Discussion: Awk - more than 99 fields?
Top Forums UNIX for Dummies Questions & Answers Awk - more than 99 fields? Post 858 by DaveM on Tuesday 23rd of January 2001 10:39:20 AM
Old 01-23-2001
Data

Just written a great little script that analyses a flat ASCII CSV file and reports for any discrepancies with field counts per record etc.

Works fine on all the flat files except one, which has 113 fields per line. AWK can only seemingly cope with up to 99 fields.

Is there any way around this? It will be a pain to check manually as there are more than 100,000 records in this file!

Cheers

Dave
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

combining fields in awk

I am using: ps -A -o command,%cpu to get process and cpu usage figures. I want to use awk to split up the columns it returns. If I use: awk '{print "Process: "$1"\nCPU Usage: "$NF"\n"}' the $NF will get me the value in the last column, but if there is more than one word in the... (2 Replies)
Discussion started by: json4639
2 Replies

2. Shell Programming and Scripting

Specifying and replacing fields with awk

#cat BATCH007.TXT 01,661060052,061000104,081118,0915,07,80,1,2/ 99,,,2/ I have this file called BATCH007.TXT. I am trying to change fields 2 and 3 on line 2 to have zeroes. Like this: 01,661060052,061000104,081118,0915,07,80,1,2/ 99,0,0,2/ I can use these commands to print identify the... (2 Replies)
Discussion started by: ddurden7
2 Replies

3. 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

4. Shell Programming and Scripting

edit fields awk

Hi there, i need some help please... I have this text, it's name data.txt that contains the following information: Mark Owen: 6999999888 6999999888 +302310999999 2310999999 Steve Blade Pit: +30691111222 2310888777 6999999888 John Rose: 2310777555 310544565 +302310999999 Mary Stuart:... (7 Replies)
Discussion started by: Mark_orig
7 Replies

5. UNIX for Dummies Questions & Answers

fields in AWK

I feel like a real leech now, 3 questions in 3 days, but hopefully when I get my head around all of this I can contribute back to this community! Anyway, so a couple of you guys have gotten me onto AWK and I've been researching it a little over the last couple of hours, now I'm somewhat sure I... (2 Replies)
Discussion started by: Aussiemick
2 Replies

6. Shell Programming and Scripting

No. of Fields using Awk

Hi, Could someone please let me know me how i can use an awk command to print the No. of fields of each file present in a Directory?Suppose the Directory has 5 text files in which the first record in each file contains fields separated by a '|'. I need to use a awk command to display the No... (8 Replies)
Discussion started by: pchegoor
8 Replies

7. Shell Programming and Scripting

Join fields comparing 4 fields using awk

Hi All, I am looking for an awk script to do the following Join the fields together only if the first 4 fields are same. Can it be done with join function in awk?? a,b,c,d,8,,, a,b,c,d,,7,, a,b,c,d,,,9, a,b,p,e,8,,, a.b,p,e,,9,, a,b,p,z,,,,9 a,b,p,z,,8,, desired output: ... (1 Reply)
Discussion started by: aksijain
1 Replies

8. Shell Programming and Scripting

How to print 1st field and last 2 fields together and the rest of the fields after it using awk?

Hi experts, I need to print the first field first then last two fields should come next and then i need to print rest of the fields. Input : a1,abc,jsd,fhf,fkk,b1,b2 a2,acb,dfg,ghj,b3,c4 a3,djf,wdjg,fkg,dff,ggk,d4,d5 Expected output: a1,b1,b2,abc,jsd,fhf,fkk... (6 Replies)
Discussion started by: 100bees
6 Replies

9. Shell Programming and Scripting

awk - compare 1st 15 fields of record with 20 fields

I'm trying to compare 2 files for differences in a selct number of fields. When differnces are found it will write the whole record of the second file including appending '|C' out to a delta file. Each record will have 20 fields, but only want to do comparison of 1st 15 fields. The 1st field of... (7 Replies)
Discussion started by: sljnk
7 Replies

10. Shell Programming and Scripting

awk sort based on difference of fields and print all fields

Hi I have a file as below <field1> <field2> <field3> ... <field_num1> <field_num2> Trying to sort based on difference of <field_num1> and <field_num2> in desceding order and print all fields. I tried this and it doesn't sort on the difference field .. Appreciate your help. cat... (9 Replies)
Discussion started by: newstart
9 Replies
tar(5)								File Formats Manual							    tar(5)

Name
       tar, mdtar - tape archive file format

Description
       The tape archive command dumps several files, including special files, into one, in a medium suitable for transportation.

       A  tape or file is a series of blocks.  Each block is of size TBLOCK.  A file on the tape is represented by a header block, which describes
       the file, followed by zero or more blocks, which give the contents of the file.	At the end of the tape are two blocks filled  with  binary
       zeros, as an end-of-file indicator.

       The  blocks  are  grouped  for  physical I/O operations.  Each group of n blocks (where n is set by the option on the command line, and the
       default is 20 blocks) is written with a single system call; on 9-track tapes, the result of this write is a single tape record.	 The  last
       group  is  always  written at the full size, so blocks after the two zero blocks contain random data.  On reading, the specified or default
       group size is used for the first read, but if that read returns less than a full tape block, the reduced block size  is	used  for  further
       reads.

       The following is an example of a header block:
       #define TBLOCK  512
       #define NAMSIZ  100

       union hblock {
	       char dummy[TBLOCK];
	       struct header {
		       char name[NAMSIZ];
		       char mode[8];
		       char uid[8];
		       char gid[8];
		       char size[12];
		       char mtime[12];
		       char chksum[8];
		       char linkflag;
		       char linkname[NAMSIZ];
		       char rdev[6]
	       } dbuf;
       };

       The  name  field  is  a	null-terminated string.  The other fields are 0-filled octal numbers in ASCII.	Each field (of width w) contains w
       minus 2 digits, a space, and a null, except size and mtime , which do not contain the trailing null.  The name field specifies the name	of
       the  file,  as  specified  on  the command line.  Files dumped because they were in a directory that was named in the command line have the
       directory name as prefix and /filename as suffix.  The field specifies the file mode, with the top bit masked off.  The uid and gid  fields
       specify	the  user  and group numbers that own the file.  The size field specifies the size of the file in bytes.  Links and symbolic links
       are dumped with this field specified as zero.  The mtime field specifies the modification time of the file at the time it was dumped.   The
       chksum  field  is a decimal ASCII value, which represents the sum of all the bytes in the header block.	When calculating the checksum, the
       chksum field is treated as if it were all blanks.  The linkflag field is ASCII 0 if the file is normal or a special file and ASCII 1 if	it
       is  a  hard  link,  and	ASCII  2  if it is a symbolic link.  The name to which it is linked, if any, is in linkname, with a trailing null.
       Unused fields of the header are binary zeros and are included in the checksum.  The rdev field encodes the ASCII representation of a device
       special file's major and minor device numbers.

       The  first  time  a given i-node number is dumped, it is dumped as a regular file.  The second and subsequent times, it is dumped as a link
       instead.  Upon retrieval, if a link entry is retrieved, but not the file it was linked to, an error message is printed and the tape must be
       manually rescanned to retrieve the linked file.

       The encoding of the header is designed to be portable across machines.

Restrictions
       Names or link names longer than NAMSIZ produce error reports and cannot be dumped.

See Also
       tar(1)

																	    tar(5)
All times are GMT -4. The time now is 03:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy