If you want output formatting, David gave you a solution for that. If you need to load the fields into variables so that you can work with the variables, the script below provides an example:
while read name age addr other do # echo name=$name age=$age addr=$addr printf "name=%-10s age=%-6s addr=%s\n" $name $age $addr done < infile
If you are asking how to pull variables from each line of your file based upon fixed column positions, then I believe you have the general idea of it. In the ksh script below, the while-loop reads each line of infile into the $line variable, then I show two different ways to split up $line based upon fixed column positions.
The information on Computing.Net is the opinions of its users. Such
opinions may not be accurate and they are to be used at your own risk.
Computing.Net cannot verify the validity of the statements made on this site. Computing.Net and Computing.Net, LLC hereby disclaim all responsibility and liability for the content of Computing.Net and its accuracy.
PLEASE READ THE FULL DISCLAIMER AND LEGAL TERMS BY CLICKING HERE