Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Find length of each line in a file.

Original Message
Name: long_unix
Date: June 13, 2007 at 08:00:43 Pacific
Subject: Find length of each line in a file.
OS: AIX
CPU/Ram: 512
Model/Manufacturer: IBM
Comment:
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


Report Offensive Message For Removal


Response Number 1
Name: nails
Date: June 13, 2007 at 09:29:57 Pacific
Subject: Find length of each line in a file.
Reply: (edit)
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


Report Offensive Follow Up For Removal

Response Number 2
Name: long_unix
Date: June 13, 2007 at 09:42:34 Pacific
Subject: Find length of each line in a file.
Reply: (edit)
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


Report Offensive Follow Up For Removal




Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Find length of each line in a file.

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software




DSHUB24 Connection Problems

need help with dsl and dial up

novel 3.12

help mandriva install last straw!

Icon Scaling in Explorer Bar


The information on Computing.Net is the opinions of its users. Such opinions may not be accurate and they are to be used at your own risk. Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE

All content ©1996-2007 Computing.Net, LLC