Sponsored Content
Top Forums Shell Programming and Scripting one solution if want fields in a file into each array Post 302368667 by pludi on Thursday 5th of November 2009 09:46:51 AM
Old 11-05-2009
It expects input via stdin or a file provided, so call it as either of these:
Code:
perl script.pl /tmp/3.txt
cat /tmp/3.txt | perl script.pl
perl script.pl </tmp/3.txt

Besides, it isn't meant to do anything, but to demonstrate how you can replace your system call to cat and cut with pure Perl, shaving off quite some time and resources off a run.
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

split varibles and store fields into shell varible array

I need to split a long varible which is a whole line read from a file into fields and store them in an array, the fields are delimited by pipe and a field may contain white spaces. I tried the following concept test and it has problem with field 5 which contain a space, appearently so because... (3 Replies)
Discussion started by: gratus
3 Replies

2. Shell Programming and Scripting

awk reading many fields to array

I want to read $3,$4,$5,$6,$7 of fileA in array and when fileb $1 = fileA $4 the i want to print array and few fields from fileB. This should work but has some syntax error. nawk -F, 'FNR==NR{a=;next} a{print a}' fileB fileA Appreciate if someone can correct this. (2 Replies)
Discussion started by: pinnacle
2 Replies

3. Shell Programming and Scripting

Ksh array solution.

I was wondering if ksh supported arrays. I have a script that may work with several hosts. I'd like a means of knowing how many hosts I'm working with and an easy way to access them (as variables) in a loop. I'm assuming there's some kind of foreach in shell scripting. (1 Reply)
Discussion started by: mrwatkin
1 Replies

4. Shell Programming and Scripting

how to spilit a row into fields and store the field content to the array

consider this is a line A#B#C#D#E#F#G#H note the delimeter is # i want to cut or spilt in to fields using the delimeter # and to store in an array. like this array=A array=B array=C array=D array=E and the array content should be displayed. echo "${array}" echo "${array}"... (5 Replies)
Discussion started by: barani75
5 Replies

5. UNIX for Dummies Questions & Answers

Fill fields with awk from an array?

Hi experts, I have been trying for a while to accomplish the following task using awk, and I just don't seem find find a way. I am not particular about using awk, it just seemed like the logical choice at first. I have a file that contains 5 fields that are delimited by a space character.... (1 Reply)
Discussion started by: GermanicGalore
1 Replies

6. Shell Programming and Scripting

awk two fields in one array

I want to compare these files while putting $1 and $2 into an array and getting rid of the punctuation. What am i doing wrong? File1.txt Apple # 223 Peach # 84; Banana # 1605. Banana # 1605; Orange # 6; Peach # 84 Peach # 84; Apple # 229; Banana # 1605. Peach # 84 Apple, # 229;... (3 Replies)
Discussion started by: sdf
3 Replies

7. Shell Programming and Scripting

Psql output into array and read 2 fields into different variables

Hello Just edited the entry to make it easier to understand what i want How can i achieve this: GOAL: read 2 field from a table with PSQL result of this PSQL command is this INSTALLEDLANG=$(su - postgres -c "psql -A -t -q -c -d ${DBNAME} -t -c 'SELECT code, iso_code from res_lang'") ... (0 Replies)
Discussion started by: winston6071
0 Replies
BP_BIOFETCH_GENBANK_PROXY(1p)				User Contributed Perl Documentation			     BP_BIOFETCH_GENBANK_PROXY(1p)

NAME
biofetch_genbank_proxy.pl - Caching BioFetch-compatible web proxy for GenBank SYNOPSIS
Install in cgi-bin directory of a Web server. Stand back. DESCRIPTION
This CGI script acts as the server side of the BioFetch protocol as described in http://obda.open-bio.org/Specs/. It provides two database access services, one for data source "genbank" (nucleotide entries) and the other for data source "genpep" (protein entries). This script works by forwarding its requests to NCBI's eutils script, which lives at http://www.ncbi.nlm.nih.gov/entrez/eutils/efetch.fcgi. It then reformats the output according to the BioFetch format so the sequences can be processed and returned by the Bio::DB::BioFetch module. Returned entries are temporarily cached on the Web server's file system, allowing frequently-accessed entries to be retrieved without another round trip to NCBI. INSTALLATION You must have the following installed in order to run this script: 1) perl 2) the perl modules LWP and Cache::FileCache 3) a web server (Apache recommended) To install this script, copy it into the web server's cgi-bin directory. You might want to shorten its name; "dbfetch" is recommended. There are several constants located at the top of the script that you may want to adjust. These are: CACHE_LOCATION This is the location on the filesystem where the cached files will be located. The default is /usr/tmp/dbfetch_cache. MAX_SIZE This is the maximum size that the cache can grow to. When the cache exceeds this size older entries will be deleted automatically. The default setting is 100,000,000 bytes (100 MB). EXPIRATION Entries that haven't been accessed in this length of time will be removed from the cache. The default is 1 week. PURGE This constant specifies how often the cache will be purged for older entries. The default is 1 hour. TESTING
To see if this script is performing as expected, you may test it with this script: use Bio::DB::BioFetch; my $db = Bio::DB::BioFetch->new(-baseaddress=>'http://localhost/cgi-bin/dbfetch', -format =>'genbank', -db =>'genbank'); my $seq = $db->get_Seq_by_id('DDU63596'); print $seq->seq," "; This should print out a DNA sequence. SEE ALSO
Bio::DB::BioFetch, Bio::DB::Registry AUTHOR
Lincoln Stein, <lstein-at-cshl.org> Copyright (c) 2003 Cold Spring Harbor Laboratory This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See DISCLAIMER.txt for disclaimers of warranty. perl v5.14.2 2012-03-02 BP_BIOFETCH_GENBANK_PROXY(1p)
All times are GMT -4. The time now is 02:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy