Sponsored Content
Top Forums Shell Programming and Scripting print first few lines, then apply regex on a specific column to print results. Post 302447887 by bartus11 on Tuesday 24th of August 2010 03:11:13 PM
Old 08-24-2010
Try:
Code:
var1='aaaaaa1'; /usr/xpg4/bin/awk -v var2=$var1 'NR<=5 || NR>5 && $11 ~ "^"var2' abc.dat

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Question about sort specific column and print other column at the same time !

Hi, This is my input file: ali 5 usa abc abu 4 uk bca alan 6 brazil bac pinky 10 utah sdc My desired output: pinky 10 utah sdc alan 6 brazil bac ali 5 usa abc abu 4 uk bca Based on the column two, I want to do the descending order and print out other related column at the... (3 Replies)
Discussion started by: patrick87
3 Replies

2. Shell Programming and Scripting

Print lines after regex

Hello, I need to print four lines inmediatly after the regexp, but not the line containing the regexp. The print should show the four lines together in one. Thanks! (13 Replies)
Discussion started by: auratus42
13 Replies

3. Shell Programming and Scripting

Print lines that match regex on xth string

Hello, I need an awk command to print only the lines that match regex on xth field from file. For example if I use this command awk -F"|" ' $22 == "20130117090000.*" 'It wont work, I think, because single quotes wont allow the usage of the metacharacter star * . On the other hand I dont know... (2 Replies)
Discussion started by: black_fender
2 Replies

4. Shell Programming and Scripting

To print lines between 2 timestamps using awk|sed and regex

Hi, I am using the following code to fetch lines that are generated in last 1 hr . Hence, I am using date function to calculate -last 1 hr & the current hr and then somehow use awk (or sed-if someone could guide me better) with some regex pattern. dt_1=`date +%h" "%d", "%Y\ %l -d "1 hour... (10 Replies)
Discussion started by: sarah-alikhan31
10 Replies

5. UNIX for Dummies Questions & Answers

How to print results from two lines using awk?

I need to print a specific string from an html file that's always occurring between two other known strings. Example: from the text below, I would like to print the bolded part: <this is a lot of text before the string I want to print> fullpath: abc/def/ghi/example.xlf -cfver. <sample text... (15 Replies)
Discussion started by: danegon
15 Replies

6. Shell Programming and Scripting

Print lines that contain a value in a specific column shared by more than 1 entity in another col

I want to expand on a question that I just asked here: I want to extract only those values in Column 2 that are shared by at least 2 unique values in Column 2. Using the same input (in this case 3- tab-separated columns): waterline-n below-sheath-v 14.8097 dock-n below-sheath-v ... (2 Replies)
Discussion started by: owwow14
2 Replies

7. Shell Programming and Scripting

awk Print New Column For Every Two Lines and Match On Multiple Column Values to print another column

Hi, My input files is like this axis1 0 1 10 axis2 0 1 5 axis1 1 2 -4 axis2 2 3 -3 axis1 3 4 5 axis2 3 4 -1 axis1 4 5 -6 axis2 4 5 1 Now, these are my following tasks 1. Print a first column for every two rows that has the same value followed by a string. 2. Match on the... (3 Replies)
Discussion started by: jacobs.smith
3 Replies

8. Shell Programming and Scripting

How to print multiple specific column after a specific word?

Hello.... Pls help me (and sorry my english) :) So I have a file (test.txt) with 1 long line.... for example: isgc jsfh udgf osff 8462 error iwzr 653 idchisfb isfbisfb sihfjfeb isfhsi gcz eifh How to print after the "error" word the 2nd 4th 5th and 7th word?? output well be: 653 isfbisfb... (2 Replies)
Discussion started by: marvinandco
2 Replies

9. Shell Programming and Scripting

Parsing OSX UNIX command results which print in multiple lines

from the CLI on a Mac, if you type networksetup -listallnetworkservices then you get results in a multi-line paragraph that look something like this: networksetup -listallnetworkservices An asterisk (*) denotes that a network service is disabled. Wi-Fi Display Ethernet Bluetooth DUN... (7 Replies)
Discussion started by: hungryd
7 Replies

10. Shell Programming and Scripting

(n)awk: print regex search output lines in one line

Hello. I have been looking high and low for the solution for this. I seems there should be a simple answer, but alas. I have a big xml file, and I need to extract certain information from specific items. The information I need can be found between a specific set of tags. let's call them... (2 Replies)
Discussion started by: Tobias-Reiper
2 Replies
IOSTAT(8)						    BSD System Manager's Manual 						 IOSTAT(8)

NAME
iostat -- report I/O statistics SYNOPSIS
iostat [-CdDITx] [-c count] [-M core] [-N system] [-w wait] [drives] DESCRIPTION
iostat displays kernel I/O statistics on terminal, disk and CPU operations. By default, iostat displays one line of statistics averaged over the machine's run time. The use of -c presents successive lines averaged over the wait period. The -I option causes iostat to print raw, unaveraged values. Only the last disk option specified (-d, -D, or -x) is used. The options are as follows: -c count Repeat the display count times. Unless the -I flag is in effect, the first display is for the time since a reboot and each sub- sequent report is for the time period since the last display. If no wait interval is specified, the default is 1 second. -C Show CPU statistics. This is enabled by default unless the -d, -D, -T, or -x flags are used. -d Show disk statistics. This is the default. Displays kilobytes per transfer, number of transfers, and megabytes transferred. Use of this flag disables display of CPU and tty statistics. -D Show alternative disk statistics. Displays kilobytes transferred, number of transfers, and time spent in transfers. Use of this flag disables the default display. -I Show the running total values, rather than an average. -M core Extract values associated with the name list from the specified core instead of the default ``/dev/mem''. -N system Extract the name list from the specified system instead of the default ``/netbsd''. -T Show tty statistics. This is enabled by default unless the -C, -d, or -D flags are used. -w wait Pause wait seconds between each display. If no repeat count is specified, the default is infinity. -x Show extended disk statistics. Each disk is displayed on a line of its own with all available statistics. This option overrides all other display options, and all disks are displayed unless specific disks are provided as arguments. Additionally, separate read and write statistics are displayed. iostat displays its information in the following format: tty tin characters read from terminals tout characters written to terminals disks Disk operations. The header of the field is the disk name and unit number. If more than four disk drives are configured in the sys- tem, iostat displays only the first four drives. To force iostat to display specific drives, their names may be supplied on the com- mand line. KB/t Kilobytes transferred per disk transfer t/s transfers per second MB/s Megabytes transferred per second The alternative display format, (selected with -D), presents the following values. KB Kilobytes transferred xfr Disk transfers time Seconds spent in disk activity cpu us % of CPU time in user mode ni % of CPU time in user mode running niced processes sy % of CPU time in system mode id % of CPU time in idle mode FILES
/netbsd Default kernel namelist. /dev/mem Default memory file. SEE ALSO
fstat(1), netstat(1), nfsstat(1), ps(1), systat(1), vmstat(1), pstat(8) The sections starting with ``Interpreting system activity'' in Installing and Operating 4.3BSD. HISTORY
iostat appeared in Version 6 AT&T UNIX. The -x option was added in NetBSD 1.4. BSD
March 1, 2003 BSD
All times are GMT -4. The time now is 02:37 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy