Hello all respected people,
Can i read a file character by character without using sed,awk and perl commands.
Thanks in advance.
Hello all respected people,
Can i read a file character by character without using sed,awk and perl commands.
Thanks in advance.
Oops, just saw "without awk ...",
so if you have fold
cnt=1; for i in $(fold -b1 inputfile);do
echo "Char # $cnt is $i"
cnt=$((cnt + 1))
done
With recent versions of bash:
cnt=1;while IFS= read -n1;do
echo "Char # $cnt is $REPLY"
cnt=$((++cnt))
done<inputfile
#! /bin/ksh
typeset -L1 single
while read line
do
while (( ${#line} > 0 ))
do
single="$line"
# do what you like with $single
echo $single
line=${line#$single}
done
done < input.txt
Read a line and process a character at a time.
while read -n 1 ch; do echo "$ch" ; done < file
Hello All,
I need to read charters position from 55 to 50, 43 to 37, etc like these random but fixed for every line. Please help