I am writing a program that will take fields of data to create usernames and passwords
Here is how the data is formatted
MWS1990 XXX-XX-XXXX STASNY, MATTHEW W SO-II BISS CPSC BS INFO TECH 412/882-0581
here is the program
for linePosition in {11..22}
do
holder=`sed -n "${linePosition}p" $1|awk '{print $1}'`
holder2=`sed -n "${linePosition}p" $1|awk '{print $12}'`
holder3=`sed -n "${linePosition}p" $1|awk '{print $7}'`
echo "UserName"
echo "$holder"
echo "password"
echo "$holder2"
echo "$holder3"
done
It returns an output like this
UserName
MWS1990
password
412/882-0581
BISS
The thing 2 things that are wrong are
I would like it to remove the year after username. So the above example would instead be just MWS. What can I add to holder=`sed -n "${linePosition}p" $1|awk '{print $1}' to make it return just the first 3 letters. (preferably in lower case but not necessary)
I would like to remove the first 6 letters of the phone number. So instead of 412/882-0581 the phone number would read 0581