How to get a third line in shell?? | Unix Linux Forums | Shell Programming and Scripting

  Go Back    


Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here.

How to get a third line in shell??

Shell Programming and Scripting


Closed Thread    
 
Thread Tools Search this Thread Display Modes
    #1  
Old 01-25-2013
Manueldo Manueldo is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 25 January 2013, 4:24 PM EST
Posts: 21
Thanks: 2
Thanked 0 Times in 0 Posts
How to get a third line in shell??

In my script I was working with the first line's elements. After That I need to find lines which start with element of first line.


Code:
file=$1
target=$2
while read line
do
  if [ "$line" != "" ]
  then
    set $line
    if [ "$1" = "$target" ]
    then
    if [ "$2" = ":" ]
    then
        for i in $3 $4 $5 $6
        do
           if [ "$i" -nt "$1" ] 
           then
           for j in  cat $file //I dont know what to add here?????
           do                              I need to find $i in lines which begin with i
           if [$j = $i] 
           
               
           fi
           done 
    fi
  fi
fi
done< $file

Sponsored Links
    #2  
Old 01-25-2013
Jotne's Avatar
Jotne Jotne is offline
Registered User
 
Join Date: Dec 2010
Last Activity: 20 September 2014, 2:08 AM EDT
Posts: 1,040
Thanks: 62
Thanked 216 Times in 204 Posts
Can you give some sample input and desired output?
Sponsored Links
    #3  
Old 01-25-2013
Manueldo Manueldo is offline
Registered User
 
Join Date: Jan 2013
Last Activity: 25 January 2013, 4:24 PM EST
Posts: 21
Thanks: 2
Thanked 0 Times in 0 Posts
juice apple table sofa // found my word it is sofa.Next step I need to find

sofa orange cuptea // this line, because it has SOFA, the same element ifound
pose glasses // in first line
    #4  
Old 01-25-2013
Jotne's Avatar
Jotne Jotne is offline
Registered User
 
Join Date: Dec 2010
Last Activity: 20 September 2014, 2:08 AM EDT
Posts: 1,040
Thanks: 62
Thanked 216 Times in 204 Posts
Its still not clear. How do you know sofa is the world you like?
Sponsored Links
    #5  
Old 01-26-2013
vbe's Avatar
vbe vbe is offline Forum Staff  
Moderator
 
Join Date: Sep 2005
Last Activity: 20 October 2014, 12:44 PM EDT
Location: Switzerland - GE
Posts: 5,833
Thanks: 162
Thanked 413 Times in 388 Posts
Closed it this seems to be homework
Sponsored Links
Closed Thread

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Shell script to read multiple options from file, line by line haggismn Shell Programming and Scripting 1 06-09-2012 09:45 PM
PERL or SHELL Scrript to search in Directories by taking line by line from a text file pasam Shell Programming and Scripting 9 12-29-2011 02:30 AM
Print pipe separated list as line by line in Korn Shell polavan Shell Programming and Scripting 3 10-28-2011 11:42 AM
Shell script to read a text file line by line & process it... new_to_shell Shell Programming and Scripting 8 09-13-2011 04:45 AM
get the fifth line of a text file into a shell script and trim the line to extract a WORD venu Shell Programming and Scripting 3 12-08-2010 08:46 PM



All times are GMT -4. The time now is 05:11 PM.