Quantcast
Channel: Count the maximum character length for all the data fields in a simplified csv file and output to txt - Unix & Linux Stack Exchange
Viewing all articles
Browse latest Browse all 5

Answer by Raza for Count the maximum character length for all the data fields in a simplified csv file and output to txt

$
0
0

I don't see your link for the sample file but you can do this by using awk command. if can specify what ever delimiter you may have and exactly what field you need to count.

    awk '{ FS = "," } ; { if(NR!=1) gsub(/"/, "", $2) ; print NR "|" length($2) } ' test.csv

You can redirect this output to any file you want.


Viewing all articles
Browse latest Browse all 5

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>