Specialty Forums
Security and Virus
General Hardware
CPUs/Overclocking
Networking
Digital Photo/Video
Office Software
PC Gaming
Console Gaming
Programming
Database
Web Development
Digital Home

General Forums
Windows XP
Windows Vista
Windows 95/98
Windows Me
Windows NT
Windows 2000
Win Server 2008
Win Server 2003
Windows 3.1
Linux
PDAs
BeOS
Novell Netware
OpenVMS
Solaris
Disk Op. System
Unix
Mac
OS/2

Drivers
Driver Scan
Driver Forum

Software
Automatic Updates

BIOS Updates

My Computing.Net

Solution Center

Free IT eBook

Howtos

Site Search

Message Find

RSS Feeds

Install Guides

Data Recovery

About

Home
Reply to Message Icon Go to Main Page Icon

Subject: Help in unix shell please please

Original Message
Name: kbhatia
Date: April 9, 2008 at 21:32:03 Pacific
Subject: Help in unix shell please please
OS: WIN X P
CPU/Ram: P4 128
Model/Manufacturer: EMACHINE
Comment:
Hi, I am trying to write a shell script that
will take information from two files and combine them into another file using loop structure


file a looks like this
carl monday
bob tuesday
ted sunday

file 2 is like
carl 3
bob 1
ted 2

output has to be

name oncall number
carol monday 3
bob tuesday 1


can anyone help me im so lost


Report Offensive Message For Removal

Response Number 1
Name: ghostdog
Date: April 10, 2008 at 02:05:26 Pacific
Subject: Help in unix shell please please
Reply: (edit)
you might want to see a pseudocode posted here: http://www.daniweb.com/forums/threa...

Report Offensive Follow Up For Removal

Response Number 2
Name: kbhatia
Date: April 10, 2008 at 05:57:44 Pacific
Subject: Help in unix shell please please
Reply: (edit)
still confised help

Report Offensive Follow Up For Removal

Response Number 3
Name: nails
Date: April 12, 2008 at 20:32:15 Pacific
Subject: Help in unix shell please please
Reply: (edit)
#!/bin/ksh

# this function reads fileb and checks if the argument passed, $1,
# equals field 1, the return field 2
function get_the_field {

retval=""
while read f1 f2
do
if [[ "$f1" == $1 ]]
then
retval=$f2
break
fi

done < fileb

echo $retval
} # end function

while read f1 f2
do
f3=$(get_the_field $f1)
str="$f1 $f2 $f3"
echo $str
done < filea



Report Offensive Follow Up For Removal



Use following form to reply to current message:

   Name: From My Computing.Net Settings
 E-Mail: From My Computing.Net Settings

Subject: Help in unix shell please please

Comments:

 
  Homepage URL (*): 
Homepage Title (*): 
         Image URL: 
 


Data Recovery Software



Version Tracker Pro
Keep your software current and secure, effortlessly

Click Here for a Free Scan

Driver Agent
Automatically find the latest drivers for your computer.
Click Here for a Free Scan



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

All content ©1996-2007 Computing.Net, LLC