The UNIX and Linux Forums
>
Top Forums
>
Shell Programming and Scripting
read a file line by line in ksh
.
User Name
Remember Me?
Password
google unix.com
Forums
Register
Forum Rules
Links
Albums
FAQ
Members List
Calendar
Search
Today's Posts
Mark Forums Read
Thread
:
read a file line by line in ksh
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
#
3
(
permalink
)
08-29-2008
Annihilannic
™
Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
The
read
command splits the line into fields separated by white space by default. You can change this by redefining the inter-field separator (IFS). Try this:
Code:
#!/bin/ksh while IFS="" read line do len=`echo "$line" | wc -c` echo $len done
Last edited by Annihilannic; 08-29-2008 at
02:54 AM
.. Reason: D'oh, too slow. :-)
Annihilannic
View Public Profile
Visit Annihilannic's homepage!
Find all posts by Annihilannic
Find Annihilannic's past nominations received
Find Annihilannic's present nominations given