#! bin/bash
#To find the length of the longest line present in the file:
echo "enter a filename to print from awk"
read fileName
if [[ -f $fileName ]]
then
awk '{ if (length($0) > max) max = length($0) } END { print max }' $fileName
echo "==============================================================="
else
echo "$fileName doesn't exist"
fi
[prabhucloudxlab@cxln4 ~]$ sh hello.sh
enter a filename to print from awk
filegrep.txt
20