Sponsored Content
Full Discussion: String operations
Top Forums Shell Programming and Scripting String operations Post 302550037 by gary_w on Wednesday 24th of August 2011 12:02:43 PM
Old 08-24-2011
Try this:
Code:
#!/bin/ksh

eval $(print "chris o'neil 200173 845747 mech engineer" | sed 's/\([^0-9]*\)\([0-9 ]*\)\([^0-9]*\)/var1="\1";var2="\2";var
3="\3"/')

## Kludgy way of getting rid of trailing space.  Should change
## the above sed command somehow.
var1=$(print $var1|sed 's/ $//')
var2=$(print $var2|sed 's/ $//')

print "[$var1]"
print "[$var2]"
print "[$var3]"

Output:
Code:
$ xyz
[chris o'neil]
[200173 845747]
[mech engineer]
$


Last edited by gary_w; 08-24-2011 at 01:12 PM.. Reason: pyt quotes around the data or else it won't handle lastname with a single quote in it.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

File operations

Hi there, I want some help on scripting regarding file processing. I have a scenario in which I have 10 files. (file1.txt, file2.txt....) and they are in paricular format. I want to read these files and append some text lines at the begining of each file and write this updated contents of... (2 Replies)
Discussion started by: chiragmistry21
2 Replies

2. Shell Programming and Scripting

String Operations

Hi All, Query 1 : I want to know how we can get a count of multipe occurrences of a particular expression in another string. For Eg. If my string is " 12" and i need to count the number of spaces preceeding 12 Query 2 : Also want to know how we can change the alignment of a... (9 Replies)
Discussion started by: Rohini Vijay
9 Replies

3. UNIX for Dummies Questions & Answers

File operations

Hi I have a tab delimited file with 3 fields. I need to sort this file on the first field and remove all the records where the first field has dulplicates. For eg my file is 133|arrfdfdg|sdfdsg 234|asfsdgfs|aasdfs 133|affbfsde|dgfg When this file gets sorted I need the result to be ... (2 Replies)
Discussion started by: monks
2 Replies

4. UNIX for Dummies Questions & Answers

AlphaNumeric String Operations

Hi :) I am writing a ksh I have a string of general format A12B3456CD78 the string is of variable length the string always ends with numbers (here it is 78.. it can be any number of digits may be 789 or just 7) before these ending numbers are alphabets (here it is CD can even be... (3 Replies)
Discussion started by: lakshmikanth
3 Replies

5. Shell Programming and Scripting

Help on shell script (string operations)

Hey everyone. So the background of the problem is that the ps3 does not support the mkv container, but DOES support the avi one. Here is the script to convert one file with the name hardcoded in: #!/bin/sh mencoder -oac... (2 Replies)
Discussion started by: wua05
2 Replies

6. Shell Programming and Scripting

String operations

Hi All, can you tell me how to drop all preceding zeros in a number. For example, if i have a numbers like 000876838347 and 0000007854762543..how to make them as 876838347 and 7854762543. (6 Replies)
Discussion started by: nram_krishna@ya
6 Replies

7. Programming

shell cursor operations

Hi I need to save the actual cursor position into variable in my script. How can I do it ? thx for help. (1 Reply)
Discussion started by: presul
1 Replies

8. Linux

Atomic Operations

Hello I am a newbie in linux. Please tell me what are atomic operations in Linux. IS i++ a atomic oparation?? Please help.. (3 Replies)
Discussion started by: aditya08
3 Replies

9. Shell Programming and Scripting

Shell operations from C++

Hi everyone, I need little help in shell operations from C++ program. Here I furnish the details of problem: 1. Lets say my current working path is myWorkingPath. 2. In my working path I have list of name directories and each name directory has two more sub directories say A/B. (now path to... (5 Replies)
Discussion started by: linuxUser_
5 Replies

10. Shell Programming and Scripting

File Operations

Hi Folks, Below is example of an Input data which is used, based on the last 2, 3 & 4 column, I want my first column data to be collated as shown in the output section. a,ac,tc,ic b,ac,tc,ic c,ac,tc,ic d,ac,tc,ic b,bc,tc,ic d,bc,tc,ic e,bc,tc,ic I want my output to be ... (2 Replies)
Discussion started by: nikhil jain
2 Replies
Bio::Symbol::AlphabetI(3pm)				User Contributed Perl Documentation			       Bio::Symbol::AlphabetI(3pm)

NAME
Bio::Symbol::AlphabetI - A Symbol Alphabet SYNOPSIS
# get a Bio::Symbol::AlphabetI object somehow my @symbols = $alphabet->symbols; my @subalphas = $alphabet->alphabets; if( $alphabet->contains($symbol) ) { # do something } DESCRIPTION
Alphabet contains set of symbols, which can be concatenated to form symbol lists. Sequence string, for example, is stringified representation of the symbol list (tokens of symbols). This module was implemented for the purposes of meeting the BSANE/BioCORBA spec 0.3 only. FEEDBACK
Mailing Lists User feedback is an integral part of the evolution of this and other Bioperl modules. Send your comments and suggestions preferably to the Bioperl mailing list. Your participation is much appreciated. bioperl-l@bioperl.org - General discussion http://bioperl.org/wiki/Mailing_lists - About the mailing lists Support Please direct usage questions or support issues to the mailing list: bioperl-l@bioperl.org rather than to the module maintainer directly. Many experienced and reponsive experts will be able look at the problem and quickly address it. Please include a thorough description of the problem with code and data examples if at all possible. Reporting Bugs Report bugs to the Bioperl bug tracking system to help us keep track of the bugs and their resolution. Bug reports can be submitted via the web: https://redmine.open-bio.org/projects/bioperl/ AUTHOR - Jason Stajich Email jason@bioperl.org APPENDIX
The rest of the documentation details each of the object methods. Internal methods are usually preceded with a _ AlphabetI Interface methods symbols Title : symbols Usage : my @symbols = $alphabet->symbols(); Function: Get/Set Symbol list for an alphabet List of symbols, which make up this alphabet. Returns : Array of L<Bio::Symbol::SymbolI> objects Args : (optional) Array of L<Bio::Symbol::SymbolI> objects alphabets Title : alphabets Usage : my @alphabets = $alphabet->alphabets(); Function: Get/Set Sub Alphabet list for an alphabet Sub-alphabets. E.g. codons made from DNAxDNAxDNA alphabets Returns : Array of L<Bio::Symbol::AlphabetI> objects Args : (optional) Array of L<Bio::Symbol::AlphabetI> objects contains Title : contains Usage : if($alphabet->contains($symbol)) { } Function: Tests of Symbol is contained in this alphabet Returns : Boolean Args : L<Bio::Symbol::SymbolI> perl v5.14.2 2012-03-02 Bio::Symbol::AlphabetI(3pm)
All times are GMT -4. The time now is 05:21 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy