The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com



UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
grep numbers mcgrailm UNIX for Dummies Questions & Answers 5 07-25-2008 01:07 AM
Fill in missing numbers in range bistru Shell Programming and Scripting 5 05-17-2006 02:42 AM
How to keep(or grep) range of line ? aungomarin Shell Programming and Scripting 1 05-08-2006 11:19 PM
grep for non numbers shihabvk Shell Programming and Scripting 6 09-20-2005 09:06 PM
grep numbers range azmathshaikh Shell Programming and Scripting 1 08-08-2005 07:45 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Bulgarian Greek Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 03-15-2009
ProgChick2oo9 ProgChick2oo9 is offline
Registered User
  
 

Join Date: Mar 2009
Posts: 1
Red face Using grep on a range of numbers

Hi im new to unix and need to find a way to grep the top 5 numbers in a file and put them into another file. For example my file looks like this


abcdef 50000
abcdef 45000
abcdef 40000
abcdef 35000
abcdef 30000
abcdef 25000
abcdef 20000
abcdef 15000
abcdef 10000
and so on...

How can i grep the top 5 of these and put them into a seperate file i know you can use range on characters but is there a way to do it on more then 1 character maybe.
Any help appreciated thanks so much!!
  #2 (permalink)  
Old 03-15-2009
vgersh99's Avatar
vgersh99 vgersh99 is online now Forum Staff  
Moderator
  
 

Join Date: Feb 2005
Location: Boston, MA
Posts: 5,121
Code:
sort -k2,2nr myFile | head -5
Closed Thread

Bookmarks

Tags
grep

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 03:08 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0