The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Special Forums > IP Networking
.
google unix.com



IP Networking Learn TCP/IP, Internet Protocol, Routing, Routers, Network protocols in this UNIX and Linux forum.

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
If Then Else Logic jadionne UNIX for Dummies Questions & Answers 7 11-23-2007 04:27 AM
cannot get the logic dineshr85 Shell Programming and Scripting 3 10-11-2007 07:34 AM
expand logic for > and < pbsrinivas Shell Programming and Scripting 0 08-10-2007 09:59 AM
Strange Logic ganesh123 Shell Programming and Scripting 5 03-20-2007 05:08 PM
Need help in genrating the logic amitjha Shell Programming and Scripting 6 11-08-2006 06:45 AM

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 09-01-2005
ramneek ramneek is offline
Registered User
  
 

Join Date: Aug 2005
Posts: 30
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 (permalink)  
Old 09-01-2005
RishiPahuja's Avatar
RishiPahuja RishiPahuja is offline
Registered User
  
 

Join Date: Apr 2005
Location: Bangalore, India
Posts: 203
Thumbs down

Please read rules and regulation of the forum.

Your questions seems to be a homework assignment. Try to figure out yourself.
  #3 (permalink)  
Old 09-05-2005
matrixmadhan matrixmadhan is offline Forum Advisor  
Technorati Master
  
 

Join Date: Mar 2005
Location: leaf node in B+ tree
Posts: 2,944
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.
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 09:47 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0