Awk rows


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers Awk rows
# 1  
Old 11-25-2009
Awk rows

I know you can awk for columns but how do you awk for rows? Fo instance rows 10-20.

Any help much appreciated.
# 2  
Old 11-25-2009
Code:
awk 'NR>=10 && NR<=20'  filename

# 3  
Old 11-25-2009
Thanks alot.
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Compare rows using awk

Hi, i want to compare all the rows of columns A and if it same then need to add its corresponding value column B and print it as a new column. eg. /vol/_1ACIFS02,482259, /vol/_1BCIFS01,122451, /vol/_2CCIFS02,2310, /vol/_2CCIFS04,11508, /vol/_2CCIFS04,8461,... (4 Replies)
Discussion started by: karan123
4 Replies

2. Shell Programming and Scripting

Combine rows with awk

I have a file of 100,000 entries that look like: chr1 980547 980667 + chr1:980547-980667 chr1 980728 980848 + chr1:980728-980848 chr1 980793 980913 + chr1:980793-980913 I am trying to reformat them to into 5 columns that are tab delineated: chr1 980547 980667 + ... (3 Replies)
Discussion started by: cmccabe
3 Replies

3. Shell Programming and Scripting

Print rows with value zero or less than zero using awk

I tried this. It working fine for small tables. But it is giving values greater than zero in a big file with 8556 columns. Does any one know why ? awk 'FNR == 1{print;next}{for(i=8556;i<=NF;i++) if($i <= 0){print;next}}' input (5 Replies)
Discussion started by: quincyjones
5 Replies

4. UNIX for Dummies Questions & Answers

awk online to exclude rows

Hello, I have 3 columns like shown below: 1 1800 1900 2 1765 1900 3 1654 2054 4 1326 1499 5 1540 1765 I want only those rows where column 2 and column 3's values don't fall within 1800-1900 both inclusive. My output should only be: 4 1326 1499 5 1540 1765 Is there a quick awk... (3 Replies)
Discussion started by: Gussifinknottle
3 Replies

5. Shell Programming and Scripting

Merging rows in awk

Hello, I have a data format as follows: Ind1 0 1 2 Ind1 0 2 1 Ind2 1 1 0 Ind2 2 2 0 I want to use AWK to have this output: Ind1 00 12 21 Ind2 12 12 00 That is to merge each two rows with the same row names. Thank you very much in advance for your help. (8 Replies)
Discussion started by: Homa
8 Replies

6. Shell Programming and Scripting

Awk match rows

Hi, I am pretty new to awk. I have a text file of the following style a b c d e f g h i 1 a b c d e f g h i 2 a b c d e f g h i 3 j k l m n o p q r 4 s t u v w x y z # 5 s t u v w x y z #7 I want the minimum of 10th column if the first 9 columns match with its before and after... (6 Replies)
Discussion started by: jacobs.smith
6 Replies

7. AIX

Rows manupulation using AWK or sed

Hi Everyon, I am stuck in a script.I have a file named file1.txt as given below: It contains 2 columns-count and filename. cat file1.txt count filename 100 A_new.txt 1000 A_full.txt 1100 B_new.txt 2000 B_full.txt 1100 C_new.txt 2000 C_full.txt ................... ..................... (10 Replies)
Discussion started by: rajsharma
10 Replies

8. UNIX for Dummies Questions & Answers

Averaging the rows using 'awk'

Dear all, I have the data in the following format. I want to do average of each NR= 5 (rows) for all the 3 ($1,$2, $3) columns and want to print average result in another file in the same format. I dont know how to write code for this in 'awk', can some one help me to write a code for this in... (1 Reply)
Discussion started by: arvindr
1 Replies

9. UNIX for Dummies Questions & Answers

Help selecting some rows with awk

Hi there, I have a text file with several colums separated by "|;#" I need to search the file extracting all columns starting with the value of "1" or "2" saving in a separate file just the first 7 columns of each row maching the criteria, with replacement of the saparators in the nearly created... (2 Replies)
Discussion started by: capnino
2 Replies

10. UNIX for Dummies Questions & Answers

sum of all matching rows using awk

I have file "1","x1897"," 89.10" "1","x2232"," -12.12" "1","x1897"," 389.10" "1","x2232"," 212.12" "1","x1897"," 19.10" "1","x2232"," 2.12" i want to add all 3 rd column rows (they have spaces also)for x1 and sum of 3rd column rows for x2 separately. I am very... (8 Replies)
Discussion started by: i.scientist
8 Replies
Login or Register to Ask a Question