Sponsored Content
Full Discussion: Extract a part of file name
Top Forums UNIX for Dummies Questions & Answers Extract a part of file name Post 302151713 by wempy on Monday 17th of December 2007 04:01:32 AM
Old 12-17-2007
or in BASH:

filename=NLL_NAM_XXXXX.XXXXXXX_1_1.txt

# ${stringSmilieosition:length}
extract=${$filename:9:13} # nb. no spaces around the colons

echo $extract

see http://tldp.org/LDP/abs/html/refcards.html#AEN20417
in the advanced bash scripting guide.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to extract certain part of log file?

Hi there, I'm having some problem with UNIX scripting (ksh), perhaps somebody can help me out? For example: ------------ Sample content of my log file (text file): -------------------------------------- File1: .... info_1 ... info_2 ... info_3 ... File2: .... info_1 ... info_2 ...... (10 Replies)
Discussion started by: superHonda123
10 Replies

2. Shell Programming and Scripting

extract last part of string.

Hi, I have a string like this BUNDLE=/home/bob/flx/user.bun how to extract only the the last part ie, only user.bun (2 Replies)
Discussion started by: vprasads
2 Replies

3. Shell Programming and Scripting

extract part of text file

I need to extract the following lines from this text and put it in different files. From xxxx@gmail.com Thu Jun 10 21:15:46 2010 Return-Path: <xxxxx@gmail.com> X-Original-To: xxx@localhost Delivered-To:xxxx@localhost Received: from ubuntu (localhost ) by ubuntu (Postfix) with ESMTP... (11 Replies)
Discussion started by: waxo
11 Replies

4. Shell Programming and Scripting

how to extract a certain part of a line

Hi friends, I want to select and use the certain part of a line. For example I have the following line home/1245/hgdf/acsdf/myhome/afolder/H2O/endfile how can I extract the part " /myhome/afolder/H2O/endfile " thanks (6 Replies)
Discussion started by: rpf
6 Replies

5. Shell Programming and Scripting

Extract part of a string

I have a file with 100s of lines of text. I want to perform an extraction of this line: Info bpzs(pid=2652) using 1000 bits I have not been able to extract it. Should I try expr match or is there another method? This line has data both in front of and in back of it. I do not have grep -o... (5 Replies)
Discussion started by: newbie2010
5 Replies

6. Shell Programming and Scripting

Extract part of file

Hello All, I need to extract part of a file into a new file My file is Define schema xxxxxx Insert into table ( a ,b ,c ,d ) values ( 1, 2, 3, (15 Replies)
Discussion started by: nnani
15 Replies

7. Shell Programming and Scripting

Extract the part of sequences from a file

I have a text file, input.fasta contains some protein sequences. input.fasta is shown below. >P02649 MKVLWAALLVTFLAGCQAKVEQAVETEPEPELRQQTEWQSGQRWELALGRFWDYLRWVQT LSEQVQEELLSSQVTQELRALMDETMKELKAYKSELEEQLTPVAEETRARLSKELQAAQA RLGADMEDVCGRLVQYRGEVQAMLGQSTEELRVRLASHLRKLRKRLLRDADDLQKRLAVY... (8 Replies)
Discussion started by: rahim42
8 Replies

8. UNIX for Advanced & Expert Users

Need help to extract part of the string

Hi, I have a string with name as 20140412-s1-Potopolive_promos_20140412. So I want to extract only Potopolive string. Could you please help me the command. O/p : Potopolive Thx in advance (5 Replies)
Discussion started by: lkeswar
5 Replies

9. Programming

Extract part of an archive to a different file

I need to save part of a file to a different one, start and end offset bytes are provided by two counters in long format. If the difference is big, how should I do it to prevent buffer overflow in java? (7 Replies)
Discussion started by: Tribe
7 Replies

10. Shell Programming and Scripting

Extract a part of variable/line content in a file

I have a variable and assigned the following values ***XYZ_201519_20150929140642_20150929140644_211_0_0_211 I need to read this variable from backward and stop read when I get first underscore (_) In this scenario I should get 211 Thanks Kris (3 Replies)
Discussion started by: mkris
3 Replies
caspar-typesetting(7)						  MISCELLANEOUS 					     caspar-typesetting(7)

  NAME
      caspar-typesetting - Makefile snippets for common typesetting tasks

  SYNOPSIS
      In a Makefile, write

	include caspar/mk/docbook.mk

      or

	include caspar/mk/pod.mk

      .

  DESCRIPTION
      The  caspar  docbook.mk  and pod.mk files are Makefile snippets for common typesetting tasks, like typesetting LaTeX (see [3]), DocBook XML,
      DocBook SGML (see [2]) and POD (see [1]) documents.  You just have to type make, instead of stuff  like  jade  -t  tex  -d  caspar/print.dsl
      /usr/share/sgml/declaration/xml.dcl foobar.dbx.

  USAGE
      In a directory where you maintain .dbx (Docbook XML) or .tex (LaTeX) files, do

	 $ echo include caspar/mk/docbook.mk > Makefile

	 $ vi karenina.dbx
	 $ make karenina.view
	 $ make karenina.print

	 $ vi svejk.tex
	 $ make svejk.view
	 $ make svejk.print

	 $ make
	 $ make clean

      Other targets: filename.ps, filename.pdf, filename.2ps, filename.html, filename.printbig, filename.dvi.

      Variables  you  might  like  to  set  in	your  Makefile:  XMLDCL (default is /usr/share/sgml/declaration/xml.dcl; if you're not on a Debian
      GNU/Linux system, you'll likely have to adjust this), HTML_DSL, PRINT_DSL.

      In a directory where you maintain .pod files, do

	 $ echo include caspar/mk/pod.mk > Makefile
	 $ vi lire.pod
	 $ perldoc ./lire.pod
	 $ make lire.pdf
	 $ make
	 $ less lire.overstrike-txt
	 $ make clean

      Other targets: filename.ps, filename.html, filename.txt, ...  (Similar to the ones supplied by docbook.mk).

  EXAMPLES
      Some examples: Overriding the caspar-supplied DSSSL files: Create your own print.dls and html.dsl, in the same directory as your Docbook XML
      files. Your Makefile should read:

       PRINT_DSL = print.dsl
       HTML_DSL = html.dsl
       include caspar/mk/docbook.mk

      Overriding the standard html-to-text convertor:

       $ W3M=lynx make svejk.txt

      .

  FILES
      caspar/mk/docbook.mk, caspar/mk/pod.mk

  ENVIRONMENT
      For  docbook.mk: files: XMLDCL, HTML_DSL, PRINT_DSL; utilities: JADE, PDFJADETEX, PDFLATEX, JADETEX, LATEX, W3M, DVIPS, PSNUP, LPR, GV; set-
      tings: JADE_MAXERRORS. These variables can get adjusted in Makefile, as well as in the shell environment.

      pod.mk Uses no environment variables.

  AUTHOR
      Joost van Baal-Ili

  SEE ALSO
      caspar(7) [1] perlpod(1) about Perl's Plain Old Documentation format

      [2] DocBook: The Definitive Guide on http://docbook.org/,

      [3] The LaTeX Project Homepage on http://www.latex-project.org/.

      Some comments on advanced usage are in the files docbook.mk and pod.mk itself.

  caspar-typesetting 20120508					      8 mai 2012					       caspar-typesetting(7)
All times are GMT -4. The time now is 04:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy