Tom's Guide | Tom's Hardware | Tom's Games
![]() |
![]() |
![]() |
Hi All,
I have a file, contains:
"jfd, jlk, slj, lsk, lskd, sldj, adk"
"sdj, lkdjf, lsdjfj, lsjf, kds, skldj, slk"
"kdj, kdsk, skd, skdk, sljs "
...
each line has quotes, spaces, commas and characters. I'd like to find the length of each line; include everything that contains in the line (", ',', space and characters). I've tried to use 'wc -c' command in the script but it did not work.Thanks in Advance
Hi All,
I have a file contains several lines and each line has different length. In each line has a space. Here is a line in a file looks like:
"AAB, FFC, EEE, FEF, JKL, JJK"
"FDL, JLJ, KK

I think you just want to read each line and find the length:
#!/bin/ksh
while read line
do
echo ${#line} # echo the line length
done < myfile.tx

It works. Thank you so much.
Hi All,
I have a file contains several lines and each line has different length. In each line has a space. Here is a line in a file looks like:
"AAB, FFC, EEE, FEF, JKL, JJK"
"FDL, JLJ, KK

![]() |
help: parsing html file u...
|
Unix: File manipulation
|

This post is quite old and has been locked from receiving new replies. Please create a new posting instead.
| Ads by Google |