The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
Google UNIX.COM


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

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
Domain not solved from script Sergiu-IT IP Networking 6 04-11-2008 02:52 AM
Kudda has successfully solved the downloading problems for numerous video web angelstar UNIX and Linux Applications 0 04-10-2008 02:41 AM
Xdmcp, dns, exceed broadcast solved BUT kymberm IP Networking 3 02-25-2003 07:47 PM

Reply
 
Submit Tools LinkBack Thread Tools Search this Thread Display Modes
  #8  
Old 11-09-2005
Registered User
 

Join Date: Jul 2005
Posts: 37
Thanx

Thank you both masters. I will test it out.

For Abhishek Ghose, The fields with in each section are tab delimited. Between the section are ___________.

Thanks again.
Reply With Quote
Forum Sponsor
  #9  
Old 11-09-2005
Registered User
 

Join Date: Jul 2005
Posts: 37
Thanks again

Perderabo's code worked very well in solaris environment, but did work under Mac OSX. Any suggestions? Thanks so much.
Reply With Quote
  #10  
Old 11-09-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
I don't have a MAC for testing so I don't know what to tell you. I am a bit surprised that the MAC even has ksh. Are you sure that it does? My script is not going to work with any other shell. It will need ksh. The public domain version of ksh, often called pdksh is good enough. I just tested the script with pdksh.
Reply With Quote
  #11  
Old 11-09-2005
Registered User
 

Join Date: Jul 2005
Posts: 137
Ruby:
Code:
num=score=""
ARGF.each { |line|
  next if line =~ /^Score diff|^____________/
  if line =~ /orthologs #(\d+).*?(\d+) bits/
    num,score = $1,$2
  else
    puts "#{num};#{score};" + line.tr("\t", ";")  if
      3 == line.count( "\t" )
  end
}
Reply With Quote
  #12  
Old 11-09-2005
Registered User
 

Join Date: Sep 2005
Location: Chennai
Posts: 80
If your records are tab delimited then this will work:

$perl -ne 'chop; split;
>if($_[0] eq "Group")
>{ $group=substr($_[3],1,length($_[3])-2);$score=$_[6];}
> else{
> if($_ !~ /^\s*$/&&$_[0] ne "Score")
> { tr/\t/;/;
> print ("\n$group;$score;$_");}}' filename

The above is commandline PERL. You can also save the same in a file and run it. I have no idea as to whether you have PERL in your environment.
Reply With Quote
  #13  
Old 11-10-2005
Registered User
 

Join Date: Jul 2005
Posts: 37
Thank you all

Thank you all very much.

For Perderabo: Yes, Mac OSX has all the Unix shells including ksh under the bin directory. Basically, Mac OSX is a freeBSD unix system. Anyway, your code worked perfectly in Solaris environment. I believe it will do under Linux but didn't test. Thanks again.

Also thank Abhishek and futurelet. Both of your code are very compact, I need to do more test and be more understand of the code.

Thanks all again.
Reply With Quote
  #14  
Old 11-10-2005
Perderabo's Avatar
Unix Daemon
 

Join Date: Aug 2001
Location: Washington DC Area
Posts: 8,667
If the MAC has a ksh, I don't know why my code would not work there. My script only uses the shell itself. It never invokes any external program. Can you post the results you get?

It might be that the MAC has an unusual echo statement. Try changing the main echo statement to be "print". Just replace the word "echo" with the word "print".
Reply With Quote
Google The UNIX and Linux Forums
Reply

Tags
linux

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes




All times are GMT -7. The time now is 05:37 AM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008. All Rights Reserved.Ad Management by RedTyger Visit The Complex Event Processing Blog

Content Relevant URLs by vBSEO 3.2.0