Currently i'm using this DO ogrinfo -al -so to extract Projection, Feature count, Field_names for a bunch of files in batch mode. Is it possible to extract number of fields & how many fields are populated with attributes ? For eg, let us assume a point file which has 70 points and three fields - ID, Name,Type. For those 70 points i would like to extract information of how many "ID" field has values, "Name" field has values and "Type" field has values.
You can do everything that is possible to do with SQL also with ogrinfo by utilizing the SQLite dialect http://www.gdal.org/ogr_sql_sqlite.html.
Once you know that the problem turns into a question about how to make such a query and the answer can be found from Stackoverflow https://stackoverflow.com/questions/17194145/sql-count-based-on-column-value
The following query might work for you but remove first newlines which I added for clarity.
ogrinfo -dialect sqlite -sql " SELECT COUNT(case WHEN ID is not null THEN 1 ELSE NULL END) as count_ID, COUNT(case WHEN Name is not null THEN 1 ELSE NULL END) as count_Name, COUNT(case WHEN Type is not null THEN 1 ELSE NULL END) as count_Type FROM your_layer" your_datasource
I tested same kind of query with statas.shp shapefile and it seems to work. I demonstrate also the flexibility of SQLite dialect by counting the number of states which belong to SUB_REGION='Mtn' as count_2.
ogrinfo -dialect sqlite -sql "select count (case WHEN STATE_NAME is not null THEN 1 ELSE NULL END) as count_1, count(case WHEN SUB_REGION='Mtn' THEN 1 ELSE NULL END) as count_2 from states" states.shp INFO: Open of `states.shp' using driver `ESRI Shapefile' successful. Layer name: SELECT Geometry: None Feature Count: 1 Layer SRS WKT: (unknown) count_1: Integer (0.0) count_2: Integer (0.0) OGRFeature(SELECT):0 count_1 (Integer) = 49 count_2 (Integer) = 8