The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
from - to delimiter bighippo Shell Programming and Scripting 6 03-13-2008 02:47 AM
awk,nawk,sed, delimiter |~| knijjar Shell Programming and Scripting 7 02-19-2008 02:38 AM
awk 2 delimiter nested onlyroshni Shell Programming and Scripting 5 10-10-2007 06:01 AM
\r as delimiter in cut shweta_d Shell Programming and Scripting 5 06-07-2007 10:18 AM
Replacement of Delimiter panknil Shell Programming and Scripting 3 05-14-2007 08:35 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 09-30-2007
Raynon Raynon is offline
Registered User
  
 

Join Date: Sep 2006
Location: Sg
Posts: 350
Cut Number which appear before a delimiter

Hi All,

How can i use the cut option to only output the number of rows, which is 2 is this case ? Pls note that the number of digit before the delimiter ":" is always varying.

$ grep -n uuu xxx
2:** xxx yyy gg 44 tt uuu 2007
$
  #2 (permalink)  
Old 09-30-2007
manas_ranjan's Avatar
manas_ranjan manas_ranjan is offline
Registered User
  
 

Join Date: Jul 2007
Location: Amsterdam
Posts: 177
if i understood clearly , u want to print the the record number which is matched by your pattern thru grep, ....then please try the following one........

echo `grep -n uuu xxx` | cut -d":" -f1

Last edited by manas_ranjan; 09-30-2007 at 07:32 AM..
  #3 (permalink)  
Old 09-30-2007
Raynon Raynon is offline
Registered User
  
 

Join Date: Sep 2006
Location: Sg
Posts: 350
Hi manas_ranjan,

That's cool.

Can you explain your cut code ?
what does the -f1 mean ?


Code:
cut -d":" -f1

Closed Thread

Bookmarks

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 09:06 AM.


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