Dear friends
I am new to linux and was trying to split some files userwise in our linux server.
I have a data file of 156 continuous columns named ecscr final.
I want the script to redirect all the lines containing a pattern of 7 digits to separate files. I was using grep to do that, as below. I have written all available patterns to a file named usercode.
while read alpha
do
cat ecscrfinal | grep -e $alpha >> mkoff.$alpha
echo "Generating markoff data for $alpha"
done < /home/ftp/ecs/usercode
But I need only those lines which have the pattern occuring at 3rd column or 81st column to go to that file. In the above case if the pattern is found any wher in the line, it is redirected to that file which gives me a wrong result.
How sed/awk/grep can be used to match a pattern occuring only at a specified field.....?
The pattern should be matched only if it is occuring in 3rd position or 81st postition.
Please help me.....i am running against a deadline.........