Hello everybody !
GOT SOMETHING INTERESTING...
I am trying to retain line number for a text document.. usually we get line numbers in VI using :set nu , but I want to permanently store them. It's a 4000 lines of text and I want grep/search it for a list of words/fields stored in a different file. what I was asked to do was a manual task. but I thought of writing a script. The script will return the whole line including the line number just embeded. So, I can directly point out where a specific word has been referred.
here is the script I got till now.
#!/bin/ksh
ctr=0
IFS="\n"
for lines in `cat plsql`
do
((ctr=${ctr}+1))
linenum="${ctr}"
if [[ ${ctr} -lt 10 ]]
then
linenum="000${ctr}"
else
if [[ ${ctr} -lt 100 ]]
then
linenum="00${ctr}"
else
if [[ ${ctr} -lt 1000 ]]
then
linenum="0${ctr}"
fi
fi
fi
echo "${linenum} ${lines}" >> plsqllin
done
Thanks