Sponsored Content
Top Forums Shell Programming and Scripting awk - compare 1st 15 fields of record with 20 fields Post 302865819 by sljnk on Sunday 20th of October 2013 01:57:07 AM
Old 10-20-2013
mjf, thank you for your help. It is working great for all my test files/scenarios
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk: record has too many fields

Hi, I'm trying this command - but get this error. Do you guys have any workaround for this? cat tf|sed 's/{//g'|sed 's/,//g'|awk '{for (i=1;i<=NF;i++) {if ($i == "OPTIME") {k = i + 2; print $i,$k}}}' awk: record `2005 Jul 28 17:35:29...' has too many fields record number 15 This is how... (3 Replies)
Discussion started by: chaandana
3 Replies

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

3. Shell Programming and Scripting

Compare fields in 2 files using AWK

Hi unix gurus, I have a urgent requirement, I need to write a AWK script to compare each fields in 2 files using AWK. Basically my output should be like this. file1 row|num1|num2|num3 1|one|two|three 2|one|two|three file2 row|num1|num2|num3 1|one|two|three 2|one|two|four ... (5 Replies)
Discussion started by: rashmisb
5 Replies

4. Shell Programming and Scripting

awk text record - prepend first field to all subsequent fields

Hello everyone, I've suddenly gotten very interested in sed and awk (and enjoying it quite a bit too) because of a large conversion project that we're working on. I'm currently stuck with a very inefficient process for processing text blocks. I'm sure someone here should be able to easily point out... (2 Replies)
Discussion started by: jameswatson3
2 Replies

5. Shell Programming and Scripting

Print all the fields of record using awk

Hi, i want to generate print statement using awk. i have 20+ and 30+ fields in each line Now its priting only first eight fields print statement as output not all. my record is as shown below filename ... (2 Replies)
Discussion started by: raghavendra.nsn
2 Replies

6. UNIX for Dummies Questions & Answers

keeping last record among group of records with common fields (awk)

input: ref.1;rack.1;1 #group1 ref.1;rack.1;2 #group1 ref.1;rack.2;1 #group2 ref.2;rack.3;1 #group3 ref.2;rack.3;2 #group3 ref.2;rack.3;3 #group3 Among records from same group (i.e. with same 1st and 2nd field - separated by ";"), I would need to keep the last record... (5 Replies)
Discussion started by: beca123456
5 Replies

7. Shell Programming and Scripting

Compare fields and keep record with bigger ID?

How do you write a shell script to compare records with the same fields then keep the biggeer id number fields (field separate by a pipe) 1150| San Jose|8|15|7|2013-02-19 00:00:00.000|2013-02-20 00:00:00.000 1263|San Jose|8|15|7|2013-02-19 00:00:00.000|2013-02-20 00:00:00.000... (4 Replies)
Discussion started by: sabercats
4 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 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

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
mpstat(1M)																mpstat(1M)

NAME
mpstat - report per-processor or per-processor-set statistics SYNOPSIS
/usr/bin/mpstat [-aq] [-p | -P set] [interval [count]] The mpstat command reports processor statistics in tabular form. Each row of the table represents the activity of one processor. The first table summarizes all activity since boot. Each subsequent table summarizes activity for the preceding interval. All values are rates listed as events per second unless otherwise noted. During execution of the kernel status command, the state of the kernel can change. If relevant, a state change message is included in the mpstat output, in one of the following forms: <<processor 3 moved from pset: -1 to: 1>> <<pset destroyed: 1>> <<pset created: 1>> <<processors added: 1, 3>> <<processors removed: 1, 3>> The mpstat command reports the following information: CPU or SET Without the -a option, mpstat reports CPU statistics for a processor ID. With the -a option, mpstat reports SET statistics for a processor set ID. minf minor faults mjf major faults xcal inter-processor cross-calls intr interrupts ithr interrupts as threads (not counting clock interrupt) csw context switches icsw involuntary context switches migr thread migrations (to another processor) smtx spins on mutexes (lock not acquired on first try) srw spins on readers/writer locks (lock not acquired on first try) syscl system calls usr percent user time sys percent system time wt the I/O wait time is no longer calculated as a percentage of CPU time, and this statistic will always return zero. idl percent idle time sze number of processors in the requested processor set set processor set membership of each CPU The following options are supported: -a Aggregate output by processor set. Sort the output by set. The default output is sorted by CPU number. -p Report processor set membership of each CPU. Sort the output by set. The default output is sorted by CPU number. -P set Display only those processors in the specified set. -q Suppress messages related to state changes. interval Report once each interval seconds. count Only print count reports. Example 1: Using mpstat to Generate User and System Operation Statistics The following command generates processor statistics over a five-second interval in two reports. The command shows the processor set mem- bership of each CPU. The default output is sorted by CPU number, aggregated by processor set, for user (usr) and system (sys) operations. example% mpstat -ap 5 2 SET minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl sze 0 6 0 355 291 190 22 0 0 0 0 43 0 2 0 43 1 1 24 17 534 207 200 70 1 0 2 0 600 4 1 0 84 2 2 19 7 353 325 318 44 0 0 5 0 345 1 1 0 94 3 3 36 2 149 237 236 14 0 0 4 0 97 0 0 0 98 2 SET minf mjf xcal intr ithr csw icsw migr smtx srw syscl usr sys wt idl sze 0 1 0 720 405 304 55 0 0 18 0 12 0 15 0 81 1 1 0 69 1955 230 200 313 33 4 41 9 7086 34 10 0 19 2 2 0 46 685 314 300 203 11 0 54 1 5287 36 6 0 28 3 3 0 0 14 386 384 0 0 0 0 0 0 0 0 0 100 2 See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ |Interface Stability |See below. | +-----------------------------+-----------------------------+ Invocation is evolving. Human readable output is unstable. sar(1), iostat(1M), sar(1M), vmstat(1M), attributes(5) The sum of CPU utilization might vary slightly from 100 due to rounding errors in the production of a percentage figure. The total time used for CPU processing is the sum of usr and sys output values, reported for user and system operations. The idl value reports the time that the CPU is idle for any reason other than pending disk I/O operations. Run the iostat command with the -x option to report I/O service times in svc_t output. The iostat utility also reports the same wt, user (us), and system (sy) statistics. See iostat(1M) for more information. When executing in a zone and if the pools facility is active, mpstat(1M) will only provide information for those processors which are a member of the processor set of the pool to which the zone is bound. 29 Jun 2005 mpstat(1M)
All times are GMT -4. The time now is 03:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy