DeepThoughts

04 Nov

little bash script

Here is a quickie I wrote to help someone with their class homework.

it takes a file with names and days and another with names and phone numbers and combines them

to give out put of name day phone, sorted by day.

#!/bin/bash
for day in Monday Tuesday Wednesday
do
lines=$(grep $day proj2-f2)
firstname=$(echo $lines | cut -d ” ” -f 1)
line2=$(grep $firstname proj2-f1)
phone=$(echo $line2 | cut -d ” ” -f 2)
echo Phone $phone
echo Day $day
echo Firstname $firstname
done

Leave a Reply

© 2010 DeepThoughts | Entries (RSS) and Comments (RSS)

Design by Your Index - Powered By Wordpress