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
Script required to get a required info from file. Pls. help me. ntgobinath Shell Programming and Scripting 2 05-31-2008 09:34 AM
from - to delimiter bighippo Shell Programming and Scripting 6 03-13-2008 02:47 AM
replace the last delimiter jisha Shell Programming and Scripting 4 01-28-2008 06:26 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 04-24-2008
ravi.sadani19 ravi.sadani19 is offline
Registered User
  
 

Join Date: Jul 2005
Posts: 42
Help required for counting delimiter

Hi All,

I have a delimited file.Sometime it happens that delimiter get missed between 2 fields,so i need to count the number of delimiter present at each line.
exam
file.txt
a|b|c|d
e|f|a
cc|dd

so output should be
1 3
2 2
3 1

Thanks
  #2 (permalink)  
Old 04-24-2008
krishmaths krishmaths is offline
Registered User
  
 

Join Date: Sep 2006
Location: Mysore, India
Posts: 191
Addressed here
  #3 (permalink)  
Old 04-24-2008
penchal_boddu penchal_boddu is offline
Registered User
  
 

Join Date: Apr 2008
Location: Bangalore
Posts: 127
Hi,

awk -F"|" '{ print NR,NF-1}' file.txt

Thanks
--penchal
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 06:30 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