for i in *.txt
do
year=$(echo "$i" | nawk -F. '{print substr($(NF-1),length($(NF-1))-1,length($(NF-1)))}')
sed "s/^/"FY$year"/" $i > new_$i # if you dont want to create a new file, then use "sed -i"
done
Xbin: I have other files also suffixing with different years and i want to include all the files in that script..How do i go abt doing it????
Itkamaraj: Your code seemed to be more dynamic but got inappropriate results..
I would love to get some kind of code that way....where if it finds 2010,2011 or 2012 in a text file, it shud automatically put in a column with appropriate year and corresponding rows...