How to find number of columns in xml file? | Unix Linux Forums | AIX

  Unix/Linux Go Back    


AIX AIX is IBM's industry-leading UNIX operating system that meets the demands of applications that businesses rely upon in today's marketplace.

How to find number of columns in xml file?

AIX


Tags
aix, unix

Closed Linux or Unix Question    
 
Thread Tools Search this Thread Display Modes
    #1  
Old Unix and Linux 01-08-2013
victory victory is offline
Registered User
 
Join Date: Jan 2012
Last Activity: 17 June 2014, 9:39 PM EDT
Posts: 27
Thanks: 0
Thanked 0 Times in 0 Posts
How to find number of columns in xml file?

How to find the number of columns in xml file.

i tried following command.


Code:

Code:
#!bin/ksh
cat $1 | grep -c "</mdm:attribute>"exit 0

but i am not getting accurate result which is not matching with the manual count.
data format :


Code:

Code:
<mdm:attribute> value </mdm:attribute>

Moderator's Comments:
No duplicate posting! Please read the rules. Continue here.

Last edited by radoulov; 01-08-2013 at 11:25 AM..
Sponsored Links
    #2  
Old Unix and Linux 01-08-2013
DGPickett DGPickett is offline Forum Advisor  
Registered User
 
Join Date: Oct 2010
Last Activity: 17 February 2015, 1:56 PM EST
Location: Southern NJ, USA (Nord)
Posts: 4,671
Thanks: 8
Thanked 585 Times in 558 Posts
The grep counts lines with matches, not matches. Preprocess the file so every > becomes a line feed and grep for "</mdm:attribute$".
Sponsored Links
Closed Linux or Unix Question

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Unix or Linux Image More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Number of columns in xml file victory Shell Programming and Scripting 6 01-08-2013 12:56 PM
How do i find the first number in each line and insert dummy string into the missing columns? Szaffy Shell Programming and Scripting 5 11-01-2011 12:27 PM
Find number of columns in a file rahul26 UNIX for Dummies Questions & Answers 13 05-08-2009 05:11 AM
extract a number within an xml file tret Shell Programming and Scripting 10 10-07-2008 07:10 PM
Cutting number from range in xml file nir_s Shell Programming and Scripting 4 07-25-2005 02:38 AM



All times are GMT -4. The time now is 02:31 AM.