View Single Post

  #1 (permalink)  
Old 09-20-2007, 10:17 PM
newbewie newbewie is offline
Junior Member
User
 
Join Date: Sep 2007
My distro: Sun Solaris/Linux
Posts: 7
Rep Power: 0
newbewie is on a distinguished road
Default Script to display number of lines and words from a file

Hi,
I need some help on scripting.
I am doing a simple echo of lines and words from a file and I also want to echo the number of lines and words to it.
Where can I get this help
A simple script I am using is
for i in `cat hostfile`
do
echo $i
done
And what I would like to do is something like this:
for i in `cat hostfile`
do
for j in ((j=1;j<=1000;j++))
do
echo $i
echo $j
done
Thanks a lot in advance
Reply With Quote