what the logic


 
Thread Tools Search this Thread
Special Forums IP Networking what the logic
# 1  
Old 09-01-2005
what the logic

i have a text file which contain some text like

we|are|one|only
i|am|learning|c++


the input from stdout will be

input1 we
input2 one

it should search in the file where this two strings are and then give the
output :

output1 are
output2 only

similarly

input1 i
input2 learning

output1 am
output2 c++

based up on the input searched we get the output fileds.| are the delimirters
# 2  
Old 09-01-2005
PHP

Please read rules and regulation of the forum.

Your questions seems to be a homework assignment. Try to figure out yourself.
# 3  
Old 09-05-2005
Hi,

This is just a vague sample of the above req mentioned.
not thoroughly tested.

echo "give the first input."
read input1

echo "give the second input."
read input2

line=`grep $input1 <filename> | grep $input2 <filename>`
output1=`echo $line | cut -f1 -d"|"`
if [ $output1 = $input1 ]
then
output1=`echo $line | cut -f2 -d"|"`
fi
output2=`echo $line | cut -f3 -d"|"`
if [ $output2 = $input2 ]
then
output2=`echo $line | cut -f4 -d"|"`
fi

echo "output1: $output1"
echo "output2: $output2"


Please let me know if my understanding and proceeding with the req was correct or not.
Login or Register to Ask a Question

Previous Thread | Next Thread

1 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Need help in logic

I have big large snapshot file which contains every process start time and end time. One server snapshot contains many Application handle. My task is to identify the process id for which the end time is not there or empty also if the completion time is not on the same date then I need to kill. ... (6 Replies)
Discussion started by: senthilkumar_ak
6 Replies
Login or Register to Ask a Question