Sponsored Content
Full Discussion: Extracting part of a string
Top Forums Shell Programming and Scripting Extracting part of a string Post 302115277 by Perderabo on Monday 23rd of April 2007 05:29:26 PM
Old 04-23-2007
How about this...
Code:
$ cat script
#! /usr/bin/ksh

echo "xyz~
chxyz36r~
~whatif
abder~000082685
mnops~000083554
fulfil302~00026" | while read line ; do
        one=${line%%~*}
        two=${line##*~}
        printf "%30s %15s %15s \n" "$line" "$one" "$two"
done
exit 0
$ ./script
                          xyz~             xyz
                     chxyz36r~        chxyz36r
                       ~whatif                          whatif
               abder~000082685           abder       000082685
               mnops~000083554           mnops       000083554
               fulfil302~00026       fulfil302           00026
$

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

extracting uncommon part between two files

Hi, I need to extract the uncommon (better say incremental) part from 2 files say file_1 and file_2. file_2 contains everything that is in file_1. That is file_2 has been created internally somehow : cat file_1 temp_file > file_2 My objective is to extract the temp_file part from... (2 Replies)
Discussion started by: sabyasm
2 Replies

2. Shell Programming and Scripting

Extracting part of the basename

Hi, I was wondering if there is an easy way to strip off the required basename. I have a script called apb0110021.sh and the contents of the script are typeset -u MScript=`basename $0 | cut -d. -f1` scriptname=sys.Audit.ksh parms="PROJECT1 dsAudit $MScript 1 BEGIN" $SCRIPTS/$scriptname... (3 Replies)
Discussion started by: madhunk
3 Replies

3. Shell Programming and Scripting

need help extracting this part

JADE TRADER 143W MYPEN 40 HC M X10 28 7 1 0 MYPEN 20 GP X X10 15 2 1 0 MYPEN 40 GP X X10 28 7 1 0 MYPEN 20... (6 Replies)
Discussion started by: finalight
6 Replies

4. Shell Programming and Scripting

awk: Extracting part of the buffer

Hi, I am trying to extract part of a line using "awk". My requirement is to extract the value $6 (which is the last parameter) from a line. As the sixth value contains some space, i am getting only part of the string. so i am trying to extract from $6 to the end of the buffer. How to do it... (7 Replies)
Discussion started by: venkat_k
7 Replies

5. Shell Programming and Scripting

Extracting a part of XML File

Hi Guys, I have a very large XML feed (2.7 MB) which crashes the server at the time of parsing. Now to reduce the load on the server I have a cron job running every 5 min.'s. This job will get the file from the feed host and keep it in the local machine. This does not solve the problem as... (9 Replies)
Discussion started by: shridhard
9 Replies

6. Shell Programming and Scripting

Extracting part of line between two words

Hi, I have a file few hundred MB's with text like one below in single line. 20091117 abc xyg 20091117 def ghi 20091118 ppp ttt 20091118 zzz zzz xxx I need to extract part of line from 1st occurence of pattern 20091117 till first occurence of another pattern 20091118. I tried... (3 Replies)
Discussion started by: artistic94555
3 Replies

7. UNIX for Dummies Questions & Answers

Extracting part of a word

I have the code message={TP=2012:09:23:00:00:00:GMT,SD=2012:09:23:00:00:00:GMT,SP=2,FT=CCGT,FG=3605} I want to extract the FG=3605 parts of this. Please help. I am trying to do this using awk or unix. (5 Replies)
Discussion started by: JenniferTopham
5 Replies

8. Shell Programming and Scripting

Extracting a part of a string

Hi, I needed to extract some specific characters from a string based on user input. For example: After the script executes the user enters the following details: Please enter the string: This is a shell script Please enter the starting position: 11 Please enter the number of characters to be... (4 Replies)
Discussion started by: ChandanN
4 Replies

9. Shell Programming and Scripting

Extracting the part of string

I have a string: 2015-04-16 07:30:05,625000 +0900 xxxx.com I just want to extract the time from the above line I am using the below syntax x=~ /(.*) (\d+)\:(\d+)\:(\d+),(.*)\.com/ $time = $2 . ':' . $3 . ':' . $4; print $time But it is not working. Can some1 please help (2 Replies)
Discussion started by: karan8810
2 Replies

10. Shell Programming and Scripting

Extracting part of data from files

Hi All, I have log files as below. log1.txt <table name="content_analyzer" primary-key="id"> <type="global" /> </table> <table name="content_analyzer2" primary-key="id"> <type="global" /> </table> Time taken: 1.008 seconds ID = gd54321bbvbvbcvb <table name="content_analyzer"... (7 Replies)
Discussion started by: ROCK_PLSQL
7 Replies
mclblastline(1) 						  USER COMMANDS 						   mclblastline(1)

  NAME
      mclblastline - a pipeline for clustering from BLAST files.

  SYNOPSIS
      mclblastline file-name

      mclblastline [deblast options] [pipeline options] file-name

      NOTE
      mcl  has acquired the ability to proceed from label input as produced by mcxdeblast. This enables a very lightweight mechanism of generating
      clusterings from BLAST files.  You might want to use this mechanism, documented in the mcl manual.

      NOTE
      mclblastline used to require (given default parameters) the presence of the zoem macro processor to produce detailed  output.   This  is	no
      longer the case. By default mclblastline now creates a line-based tab-separated dump file.  Zoem will be invoked when the --fmt-fancy option
      is supplied.  In that case, zoem obviously has to be installed.

  DESCRIPTION
      mclblastline wraps around mclpipeline. It supplies the --parser=app and --parser-tag=str options, setting them  respectively  to	mcxdeblast
      and  blast.  This  tells	mclpipeline  to use mcxdeblast as the parse script in its pipeline.  The significance of the blast tag is that any
      mcxdeblast option can be passed through mclblastline and mclpipeline by inserting this tag into the option.  For example, mcxdeblast accepts
      the  --score=x option.  When using mclblastline, you specify it as --blast-score=x.  There are two exceptions to this rule, namely the --xi-
      dat=str and --xo-dat=str options. Refer to the mclpipeline manual for more information.

      Additionally, all mclpipeline options are acceptable to mcxdeblast as well. The --whatif is useful for getting a feel for the pipeline.  The
      --mcl-I=f  inflation  option  and --mcl-scheme=i scheme index options are your basic means for respectively manipulating cluster granularity
      and allocating resources. Read the mcl manual entries for a description of the corresponding -I and -scheme mcl options.

      The best advice is to glance over the mcxdeblast and mclpipeline options in order to get a feeling for which of those may come in handy  for
      you. Then start experimenting. Use the --whatif option, it will tell you what would happen without actually doing it.

  OPTIONS
      All mcxdeblast and mclpipeline options.  mcxdeblast options must be passed using the mechanism described above.

  EXAMPLES
	 mclblastline --blast-score=b
	    --blast-sort=a --blast-bcut=5 --mcl-I=2.5 myblastfile

      This  will use bit scores, sort cluster indices such that the corresponding labels are ordered alphabetically, ignore bit scores not exceed-
      ing 5, and use inflation value 2.5. In this case, the output clustering will be in the file named  myblastfile.I25s2  (I25  identifying  the
      inflation value and s2 identifying the resource scheme) and the formatted output will be in the file myblastfile.I25s2.fmt.

	 mclblastline --prepare-mcl myblastfile
	 mclblastline --start-mcl --mcl-I=1.2 myblastfile
	 mclblastline --start-mcl --mcl-I=1.6 myblastfile
	 mclblastline --start-mcl --mcl-I=2.0 myblastfile
	 mclblastline --start-mcl --mcl-I=2.4 myblastfile
	 mclblastline --start-mcl --mcl-I=2.8 myblastfile
	 etc ..

      The  first  run  prepares  an input matrix to be read by mcl.  In this case its file will be named myblastfile.sym.  The subsequent runs use
      this matrix.  CAVEAT there are some options that you need to repeat when executing such a resumed  run.  They  are  clearly  marked  in  the
      mclpipeline manual - namely those options that affect names of (intermediate) files. Most importantly, this concerns the mclpipeline options
      that have prefix --xo or --xi. For example,

	 mclblastline --prepare-mcl --blast-score=b --xo-dat=b myblastfile
	 mclblastline --start-mcl --xo-dat=b --mcl-I=1.2 myblastfile
	 mclblastline --start-mcl --xo-dat=b --mcl-I=1.6 myblastfile
	 mclblastline --start-mcl --xo-dat=b --mcl-I=2.0 myblastfile
	 mclblastline --start-mcl --xo-dat=b --mcl-I=2.4 myblastfile
	 mclblastline --start-mcl --xo-dat=b --mcl-I=2.8 myblastfile
	 etc ..

      In this case, the matrix file will be named myblastfile.b.sym, and the --xo-dat options must be repeated in all runs so  that  the  pipeline
      reconstructs the correct file name(s).

  AUTHOR
      Stijn van Dongen

  SEE ALSO
      mcxdeblast, mclpipeline, mcxassemble.

  mclblastline 12-068						      8 Mar 2012						     mclblastline(1)
All times are GMT -4. The time now is 05:41 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy