![]() |
|
|
|
|
|||||||
| Forums | Portal | Register | Forum Rules | FAQ | Contribute | Members List | Arcade | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts here. |
|
|
||||
| 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 |
|
|
Submit Tools | LinkBack | Thread Tools | Search this Thread | Display Modes |
|
#8
|
|||
|
|||
|
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. |
| Forum Sponsor | ||
|
|
|
#9
|
|||
|
|||
|
Thanks again
Perderabo's code worked very well in solaris environment, but did work under Mac OSX. Any suggestions? Thanks so much.
|
|
#10
|
||||
|
||||
|
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.
|
|
#11
|
|||
|
|||
|
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
}
|
|
#12
|
|||
|
|||
|
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. |
|
#13
|
|||
|
|||
|
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. |
|
#14
|
||||
|
||||
|
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". |
||||
| Google The UNIX and Linux Forums |